@mtillmann/chapters 0.0.1

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.
@@ -0,0 +1,295 @@
1
+ interface Chapter {
2
+ startTime: number;
3
+ endTime?: number;
4
+ img?: string;
5
+ img_type?: string;
6
+ img_filename?: string;
7
+ id?: string;
8
+ duration?: number;
9
+ title?: string;
10
+ url?: string;
11
+ location?: string;
12
+ toc?: boolean;
13
+ }
14
+
15
+ interface MediaItemMeta {
16
+ author?: string;
17
+ title?: string;
18
+ podcastName?: string;
19
+ description?: string;
20
+ fileName?: string;
21
+ waypoints?: boolean;
22
+ version?: string;
23
+ }
24
+
25
+ interface MediaItem {
26
+ chapters: Chapter[];
27
+ meta: MediaItemMeta;
28
+ supportsPrettyPrint: boolean;
29
+ chapterTitleTemplate: string;
30
+ defaultMeta: MediaItemMeta;
31
+ filename: string;
32
+ mimeType: string;
33
+ duration: number;
34
+ isChapterFormat: boolean;
35
+ to: (format: any) => any;
36
+ rebuildChapterTitles: () => void;
37
+ toString: (pretty?: boolean, exportOptions?: any) => string;
38
+ detect: (inputString: string) => boolean;
39
+ from: (input: string | MediaItem) => MediaItem;
40
+ add: (chapter: Chapter) => void;
41
+ expandFirstToStart: () => void;
42
+ remove: (index: number) => void;
43
+ applyImgUri: (prefix: string) => void;
44
+ ensureUniqueFilenames: () => void;
45
+ chapterIndexFromTime: (time: number | string) => number | null;
46
+ chapterIndexFromStartTime: (time: number | string) => number;
47
+ updateChapterStartTime: (index: number, time: string | number) => number | 'timeInUse';
48
+ addChapterAt: (index: number, chapter?: object) => number;
49
+ addChapterAtTime: (time: number | string, chapter?: object) => boolean;
50
+ }
51
+
52
+ declare const AutoFormat: {
53
+ classMap: Record<string, any>;
54
+ detect(inputString: string, returnWhat?: 'instance' | 'key' | 'class'): any;
55
+ from(inputString: string): MediaItem;
56
+ as(classKeyOrClass: any, input: string): MediaItem;
57
+ };
58
+
59
+ declare abstract class Base implements MediaItem {
60
+ supportsPrettyPrint: boolean;
61
+ chapterTitleTemplate: string;
62
+ chapters: Chapter[];
63
+ defaultMeta: MediaItemMeta;
64
+ meta: MediaItemMeta;
65
+ filename: string;
66
+ mimeType: string;
67
+ duration: number;
68
+ isChapterFormat: boolean;
69
+ static create(input?: string | MediaItem): MediaItem;
70
+ from(input?: string | MediaItem): MediaItem;
71
+ detect(inputString: string): boolean;
72
+ test(data: object): {
73
+ errors: string[];
74
+ };
75
+ bump(keepDuration?: boolean): void;
76
+ endTime(index: number): number;
77
+ expandFirstToStart(): void;
78
+ add(chapter: Chapter): void;
79
+ remove(index: number): void;
80
+ to(className: any): MediaItem;
81
+ parse(string: string): void;
82
+ toString(pretty?: boolean, exportOptions?: {}): string;
83
+ applyChapterMinLength(seconds: number): object;
84
+ addChapterAt(index: number, chapter?: object): number;
85
+ addChapterAtTime(time: number | string, chapter?: object): boolean;
86
+ rebuildChapterTitles(template?: string): void;
87
+ ensureTitle(index: number): string;
88
+ getChapterTitle(index: number, template?: string): string;
89
+ chapterExistsAtStartTime(time: number): boolean;
90
+ updateChapterStartTime(index: number, startTime: number | string): number | 'timeInUse';
91
+ chapterIndexFromStartTime(startTime: number | string): number;
92
+ chapterIndexFromTime(time: number | string): null | number;
93
+ ensureUniqueFilenames(): void;
94
+ applyImgUri(imgUri: string): void;
95
+ }
96
+
97
+ declare class MatroskaXML extends Base {
98
+ supportsPrettyPrint: boolean;
99
+ filename: string;
100
+ mimeType: string;
101
+ chapterStringNodeName: string;
102
+ inputTimeToSeconds(string: string): number;
103
+ secondsToOutputTime(seconds: number): string;
104
+ detect(inputString: string): boolean;
105
+ parse(string: string): void;
106
+ toString(pretty?: boolean): string;
107
+ }
108
+
109
+ declare class AppleChapters extends MatroskaXML {
110
+ supportsPrettyPrint: boolean;
111
+ filename: string;
112
+ mimeType: string;
113
+ detect(inputString: string): boolean;
114
+ parse(string: string): void;
115
+ toString(pretty?: boolean, exportOptions?: any): string;
116
+ }
117
+
118
+ declare class AppleHLS extends Base {
119
+ filename: string;
120
+ mimeType: string;
121
+ supportsPrettyPrint: boolean;
122
+ titleLanguage: string;
123
+ imageDims: number[];
124
+ test(data: object[]): {
125
+ errors: string[];
126
+ };
127
+ parse(string: string): void;
128
+ toString(pretty?: boolean): string;
129
+ }
130
+
131
+ declare class ChaptersJson extends Base {
132
+ supportsPrettyPrint: boolean;
133
+ }
134
+
135
+ declare class FFMetadata extends Base {
136
+ filename: string;
137
+ mimeType: string;
138
+ characters: string[];
139
+ safeCharacters: string;
140
+ unescapeRegexp: RegExp;
141
+ escapeRegexp: RegExp;
142
+ detect(inputString: string): boolean;
143
+ parse(string: string): void;
144
+ unescape(string: string): string;
145
+ escape(string: string): string;
146
+ toString(): string;
147
+ }
148
+
149
+ declare class FFMpegInfo extends Base {
150
+ detect(inputString: string): boolean;
151
+ parse(input: string): void;
152
+ toString(): string;
153
+ }
154
+
155
+ declare class MKVMergeSimple extends Base {
156
+ filename: string;
157
+ mimeType: string;
158
+ protected zeroPad: number;
159
+ detect(inputString: string): boolean;
160
+ parse(string: string): void;
161
+ toString(): string;
162
+ }
163
+
164
+ declare class MKVMergeXML extends MatroskaXML {
165
+ supportsPrettyPrint: boolean;
166
+ filename: string;
167
+ mimeType: string;
168
+ chapterStringNodeName: string;
169
+ inputTimeToSeconds(string: string): number;
170
+ secondsToOutputTime(seconds: number): string;
171
+ }
172
+
173
+ declare class MP4Chaps extends Base {
174
+ filename: string;
175
+ mimeType: string;
176
+ detect(inputString: string): boolean;
177
+ parse(string: string): void;
178
+ toString(): string;
179
+ }
180
+
181
+ declare class PodloveJson extends Base {
182
+ filename: string;
183
+ mimeType: string;
184
+ test(data: object[]): {
185
+ errors: string[];
186
+ };
187
+ parse(string: string): void;
188
+ toString(pretty?: boolean): string;
189
+ }
190
+
191
+ declare class PodloveSimpleChapters extends Base {
192
+ supportsPrettyPrint: boolean;
193
+ filename: string;
194
+ mimeType: string;
195
+ detect(inputString: string): boolean;
196
+ parse(string: string): void;
197
+ toString(pretty?: boolean): string;
198
+ }
199
+
200
+ declare class PySceneDetect extends Base {
201
+ filename: string;
202
+ mimeType: string;
203
+ detect(inputString: string): boolean;
204
+ parse(string: string): void;
205
+ toString(pretty?: boolean, exportOptions?: any): string;
206
+ }
207
+
208
+ declare class Scenecut extends Base {
209
+ filename: string;
210
+ mimeType: string;
211
+ frameRate: number;
212
+ /**
213
+ * The number "1001" in the context of video processing and multimedia, especially in relation to frame rates and timecodes, is often associated with the NTSC color system used in North America and Japan.
214
+ * In this system, the frame rate is often described as "29.97 frames per second", but it's technically 30000/1001 frames per second, which is approximately 29.97 but not exactly. This is known as a "drop frame" rate, and the "1001" comes from this fractional frame rate.
215
+ */
216
+ ptsScale: number;
217
+ score: number;
218
+ test(data: object[]): {
219
+ errors: string[];
220
+ };
221
+ parse(string: string): void;
222
+ toString(pretty?: boolean, exportOptions?: {}): string;
223
+ }
224
+
225
+ declare class ShutterEDL extends Base {
226
+ detect(inputString: string): boolean;
227
+ decodeTime(timeString: string): string;
228
+ encodeTime(time: number): string;
229
+ parse(input: string): void;
230
+ toString(): string;
231
+ }
232
+
233
+ declare class VorbisComment extends MKVMergeSimple {
234
+ filename: string;
235
+ mimeType: string;
236
+ zeroPad: number;
237
+ }
238
+
239
+ declare class WebVTT extends Base {
240
+ filename: string;
241
+ mimeType: string;
242
+ detect(inputString: string): boolean;
243
+ parse(string: string): void;
244
+ toString(): string;
245
+ }
246
+
247
+ declare class Youtube extends Base {
248
+ filename: string;
249
+ mimeType: string;
250
+ detect(inputString: string): boolean;
251
+ parse(string: string): void;
252
+ toString(): string;
253
+ }
254
+
255
+ declare function zeroPad(num: string | number, len?: number): string;
256
+ declare function secondsToTimestamp(seconds: number | string, options?: any): string;
257
+ /**
258
+ * Converts a NPT (normal play time) to seconds, used by podlove simple chapters
259
+ */
260
+ declare function NPTToSeconds(npt: string): number;
261
+ declare function secondsToNPT(seconds: number): string;
262
+ declare function timestampToSeconds(timestamp: string, fixedString?: boolean): number;
263
+ declare function hash(): string;
264
+ declare function escapeRegExpCharacters(text: string): string;
265
+ declare function enforceMilliseconds(seconds: number): number;
266
+ declare function formatBytes(bytes: number, decimals?: number, format?: 'kB' | 'KiB'): string;
267
+ declare function Int(value: unknown, defaultValue?: number): number;
268
+ declare function Float(value: unknown, defaultValue?: number): number;
269
+ declare function Ints(value: unknown[], defaultValue?: number): number[];
270
+ declare function Floats(value: unknown[], defaultValue?: number): number[];
271
+ declare function indenter(spacesPerDepth?: number): (depth: number, string: string) => string;
272
+ declare function stringToLines(string: string): string[];
273
+ declare function toSeconds(input: number | string): number;
274
+
275
+ declare const util_Float: typeof Float;
276
+ declare const util_Floats: typeof Floats;
277
+ declare const util_Int: typeof Int;
278
+ declare const util_Ints: typeof Ints;
279
+ declare const util_NPTToSeconds: typeof NPTToSeconds;
280
+ declare const util_enforceMilliseconds: typeof enforceMilliseconds;
281
+ declare const util_escapeRegExpCharacters: typeof escapeRegExpCharacters;
282
+ declare const util_formatBytes: typeof formatBytes;
283
+ declare const util_hash: typeof hash;
284
+ declare const util_indenter: typeof indenter;
285
+ declare const util_secondsToNPT: typeof secondsToNPT;
286
+ declare const util_secondsToTimestamp: typeof secondsToTimestamp;
287
+ declare const util_stringToLines: typeof stringToLines;
288
+ declare const util_timestampToSeconds: typeof timestampToSeconds;
289
+ declare const util_toSeconds: typeof toSeconds;
290
+ declare const util_zeroPad: typeof zeroPad;
291
+ declare namespace util {
292
+ export { util_Float as Float, util_Floats as Floats, util_Int as Int, util_Ints as Ints, util_NPTToSeconds as NPTToSeconds, util_enforceMilliseconds as enforceMilliseconds, util_escapeRegExpCharacters as escapeRegExpCharacters, util_formatBytes as formatBytes, util_hash as hash, util_indenter as indenter, util_secondsToNPT as secondsToNPT, util_secondsToTimestamp as secondsToTimestamp, util_stringToLines as stringToLines, util_timestampToSeconds as timestampToSeconds, util_toSeconds as toSeconds, util_zeroPad as zeroPad };
293
+ }
294
+
295
+ export { AppleChapters, AppleHLS, AutoFormat, ChaptersJson, FFMetadata, FFMpegInfo, MKVMergeSimple, MKVMergeXML, MP4Chaps, MatroskaXML, PodloveJson, PodloveSimpleChapters, PySceneDetect, Scenecut, ShutterEDL, util as Util, VorbisComment, WebVTT, Youtube };