-
Notifications
You must be signed in to change notification settings - Fork 0
/
chaptertool.js
34 lines (30 loc) · 969 Bytes
/
chaptertool.js
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
#!/usr/bin/env node
import {ArgumentParser} from "./src/CLI/ArgumentParser.js";
import {ChapterGenerator} from "./src/CLI/ChapterGenerator.js";
import {AudioExtractor} from "./src/CLI/AudioExtractor.js";
import * as dotenv from 'dotenv';
import {Server} from "./src/Server.js";
import {ChapterConverter} from "./src/CLI/ChapterConverter.js";
dotenv.config();
const CLIArgs = new ArgumentParser();
const help = `chaptertool
available commands:
generate generate chapters from video file
convert convert chapter files between different formats
serve run the web ui
`
switch (CLIArgs.action) {
case 'generate' :
new AudioExtractor(CLIArgs.options).extract();
new ChapterGenerator(CLIArgs.options).generate();
break;
case 'convert' :
new ChapterConverter(CLIArgs.options);
break;
case 'serve' :
new Server(CLIArgs.options);
break;
default:
console.log(help);
break;
}