@glissade/cli 0.8.0-pre.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cues.js +17 -4
- package/package.json +10 -10
package/dist/cues.js
CHANGED
|
@@ -17,6 +17,7 @@ function collectCues(markers) {
|
|
|
17
17
|
t: m.t,
|
|
18
18
|
kind: data.kind,
|
|
19
19
|
name: m.name,
|
|
20
|
+
...typeof data.title === "string" ? { title: data.title } : {},
|
|
20
21
|
...typeof data.duration === "number" ? { duration: data.duration } : {}
|
|
21
22
|
});
|
|
22
23
|
}
|
|
@@ -27,12 +28,24 @@ function vttTime(seconds) {
|
|
|
27
28
|
const p = (n, w = 2) => String(n).padStart(w, "0");
|
|
28
29
|
return `${p(Math.floor(ms / 36e5))}:${p(Math.floor(ms % 36e5 / 6e4))}:${p(Math.floor(ms % 6e4 / 1e3))}.${p(ms % 1e3, 3)}`;
|
|
29
30
|
}
|
|
30
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* WebVTT chapters from cues; each runs until its duration or the next cue. The
|
|
33
|
+
* cue text is the human `title` (falling back to `name`), not the machine
|
|
34
|
+
* `kind`. When the earliest cue starts after 0, a `00:00` "Intro" chapter is
|
|
35
|
+
* auto-anchored — both valid WebVTT and required for YouTube description
|
|
36
|
+
* chapters (which read the cue text as the title and need a 0:00 start).
|
|
37
|
+
*/
|
|
31
38
|
function cuesToVtt(cues, totalDuration) {
|
|
39
|
+
const anchored = cues.length > 0 && cues[0].t > 0 ? [{
|
|
40
|
+
t: 0,
|
|
41
|
+
kind: "chapter",
|
|
42
|
+
name: "Intro",
|
|
43
|
+
title: "Intro"
|
|
44
|
+
}, ...cues] : cues;
|
|
32
45
|
let out = "WEBVTT\n\n";
|
|
33
|
-
|
|
34
|
-
const end = c.duration !== void 0 ? c.t + c.duration :
|
|
35
|
-
out += `${c.name}\n${vttTime(c.t)} --> ${vttTime(end)}\n${c.
|
|
46
|
+
anchored.forEach((c, i) => {
|
|
47
|
+
const end = c.duration !== void 0 ? c.t + c.duration : anchored[i + 1]?.t ?? totalDuration;
|
|
48
|
+
out += `${c.name}\n${vttTime(c.t)} --> ${vttTime(end)}\n${c.title ?? c.name}\n\n`;
|
|
36
49
|
});
|
|
37
50
|
return out;
|
|
38
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/cli",
|
|
3
|
-
"version": "0.8.0
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "glissade CLI: headless rendering via backend-skia (+ FFmpeg mux).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"@napi-rs/canvas": "^0.1.65",
|
|
21
21
|
"esbuild": "^0.28.0",
|
|
22
22
|
"jiti": "^2.4.2",
|
|
23
|
-
"@glissade/backend-skia": "0.8.0
|
|
24
|
-
"@glissade/core": "0.8.0
|
|
25
|
-
"@glissade/interact": "0.8.0
|
|
26
|
-
"@glissade/lottie": "0.8.0
|
|
27
|
-
"@glissade/svg": "0.8.0
|
|
28
|
-
"@glissade/narrate": "0.8.0
|
|
29
|
-
"@glissade/player": "0.8.0
|
|
30
|
-
"@glissade/scene": "0.8.0
|
|
31
|
-
"@glissade/sfx": "0.8.0
|
|
23
|
+
"@glissade/backend-skia": "0.8.0",
|
|
24
|
+
"@glissade/core": "0.8.0",
|
|
25
|
+
"@glissade/interact": "0.8.0",
|
|
26
|
+
"@glissade/lottie": "0.8.0",
|
|
27
|
+
"@glissade/svg": "0.8.0",
|
|
28
|
+
"@glissade/narrate": "0.8.0",
|
|
29
|
+
"@glissade/player": "0.8.0",
|
|
30
|
+
"@glissade/scene": "0.8.0",
|
|
31
|
+
"@glissade/sfx": "0.8.0"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|