-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
cli.ts
74 lines (64 loc) · 2.13 KB
/
cli.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env node
import { program } from "commander";
import pkg from "./package.json";
import { forAction } from "./actions/for";
import { modelsAction } from "./actions/models";
import { modelsPurgeAction } from "./actions/modelsPurge";
import { modelsLs } from "./actions/modelsLs";
import { burnInAction } from "./actions/burnIn";
import { embedAction } from "./actions/embed";
program.name(pkg.name).description(pkg.description).version(pkg.version);
program
.command("for <path>")
.description("Generate subtitles for a given video or audio file.")
.option(
"-m, --model [modelName]",
"The name of the machine learning model you'd like to use to generate subtitles.",
"vosk-model-small-en-us-0.15",
)
.option(
"-b, --burn-in",
"Whether to layer subtitles atop the video (burn them in).",
false,
)
.option(
"-e, --embed",
"Whether to embed subtitles in the video's metadata.",
false,
)
.option(
"-o, --out-dir [path]",
"Where to output the subtitles file.",
process.cwd(),
)
.option(
"-f, --format [format]",
"Choose between `srt` or `ass` formats. (Default `srt`)",
"srt",
)
.option(
'-h --highlight [color]',
"(`ass` subtitles only) Highlight the active word with a color. (Default `#048BA8`)",
)
.action(forAction);
const models = program
.command("models")
.description("Manage models")
.action(modelsAction);
models.command("purge")
.action(modelsPurgeAction)
.description("Delete all downloaded models.")
models.command("ls")
.description(
"Show a list of all models downloaded to the system.",
)
.action(modelsLs);
program
.command("burn-in <video> <subtitles>")
.description("Burn subtitles into a video. Video is output in the same directiory with a suffix added.")
.action(burnInAction);
program
.command("embed <video> <subtitles>")
.description("Embed subtitles to a video. Video is output in the same directiory with a suffix added.")
.action(embedAction);
program.parse(process.argv);