feat: refine subtitle flow and study UI
This commit is contained in:
1 parent
6a6fd347bd
commit
0608b84664
24 files changed
+795
-730
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import assert from "node:assert/strict";
|
||||
import adminHelpers from "../admin.js";
|
||||
|
||||
const { buildWebVtt, parseSubtitleBlocks, shiftCueTimeRange, shiftSubtitleCues } = adminHelpers;
|
||||
const { buildWebVtt, parseSubtitleBlocks } = adminHelpers;
|
||||
|
||||
const cues = parseSubtitleBlocks(`WEBVTT
|
||||
|
||||
@@ -41,23 +41,5 @@ Second line
|
||||
continued
|
||||
`);
|
||||
|
||||
assert.equal(
|
||||
shiftCueTimeRange("00:00:00.200 --> 00:00:01.200", -0.5),
|
||||
"00:00:00.000 --> 00:00:00.700",
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
shiftCueTimeRange("00:00:04.000 --> 00:00:08.000", 0.5),
|
||||
"00:00:04.500 --> 00:00:08.500",
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
shiftCueTimeRange("00:00:04.000 --> 00:00:08.000", 0.2),
|
||||
"00:00:04.200 --> 00:00:08.200",
|
||||
);
|
||||
|
||||
const shifted = shiftSubtitleCues([
|
||||
{ timeRange: "00:00:04.000 --> 00:00:08.000", text: "Second line" },
|
||||
], 1.25);
|
||||
assert.equal(shifted[0].timeRange, "00:00:05.250 --> 00:00:09.250");
|
||||
assert.equal(shifted[0].text, "Second line");
|
||||
assert.equal(adminHelpers.shiftCueTimeRange, undefined);
|
||||
assert.equal(adminHelpers.shiftSubtitleCues, undefined);
|
||||
Reference in new issue
Block a user