mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
add node-webvtt for parsing subtitles
This commit is contained in:
parent
935cb2427b
commit
7bf1d05f16
4 changed files with 3636 additions and 3617 deletions
|
@ -16,6 +16,7 @@
|
||||||
"json5": "^2.2.0",
|
"json5": "^2.2.0",
|
||||||
"lodash.throttle": "^4.1.1",
|
"lodash.throttle": "^4.1.1",
|
||||||
"nanoid": "^4.0.0",
|
"nanoid": "^4.0.0",
|
||||||
|
"node-webvtt": "^1.9.4",
|
||||||
"ofetch": "^1.0.0",
|
"ofetch": "^1.0.0",
|
||||||
"pako": "^2.1.0",
|
"pako": "^2.1.0",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
|
|
27
src/types/node_webtt.d.ts
vendored
Normal file
27
src/types/node_webtt.d.ts
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
declare module "node-webvtt" {
|
||||||
|
interface Cue {
|
||||||
|
identifier: string;
|
||||||
|
start: number;
|
||||||
|
end: number;
|
||||||
|
text: string;
|
||||||
|
styles: string;
|
||||||
|
}
|
||||||
|
interface Options {
|
||||||
|
meta?: boolean;
|
||||||
|
strict?: boolean;
|
||||||
|
}
|
||||||
|
type ParserError = Error;
|
||||||
|
interface ParseResult {
|
||||||
|
valid: boolean;
|
||||||
|
strict: boolean;
|
||||||
|
cues: Cue[];
|
||||||
|
errors: ParserError[];
|
||||||
|
meta?: Map<string, string>;
|
||||||
|
}
|
||||||
|
interface Segment {
|
||||||
|
duration: number;
|
||||||
|
cues: Cue[];
|
||||||
|
}
|
||||||
|
function parse(text: string, options: Options): ParseResult;
|
||||||
|
function segment(input: string, segmentLength?: number): Segment[];
|
||||||
|
}
|
|
@ -16,6 +16,7 @@
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
"baseUrl": "./src",
|
"baseUrl": "./src",
|
||||||
|
"typeRoots": ["./src/types"],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./*"]
|
"@/*": ["./*"]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue