@mtillmann/chapters 0.0.2 → 0.1.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/index.d.ts +3 -1
- package/dist/index.js +6 -5
- package/package.json +1 -1
- package/readme.md +6 -2
package/dist/index.d.ts
CHANGED
|
@@ -66,7 +66,8 @@ declare abstract class Base implements MediaItem {
|
|
|
66
66
|
mimeType: string;
|
|
67
67
|
duration: number;
|
|
68
68
|
isChapterFormat: boolean;
|
|
69
|
-
|
|
69
|
+
constructor(duration?: number);
|
|
70
|
+
static create(input?: string | MediaItem, duration?: number): MediaItem;
|
|
70
71
|
from(input?: string | MediaItem): MediaItem;
|
|
71
72
|
detect(inputString: string): boolean;
|
|
72
73
|
test(data: object): {
|
|
@@ -206,6 +207,7 @@ declare class PySceneDetect extends Base {
|
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
declare class Scenecut extends Base {
|
|
210
|
+
supportsPrettyPrint: boolean;
|
|
209
211
|
filename: string;
|
|
210
212
|
mimeType: string;
|
|
211
213
|
frameRate: number;
|
package/dist/index.js
CHANGED
|
@@ -189,8 +189,11 @@ var Base = class {
|
|
|
189
189
|
mimeType = "application/json";
|
|
190
190
|
duration = 0;
|
|
191
191
|
isChapterFormat = true;
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
constructor(duration = 3600) {
|
|
193
|
+
this.duration = duration;
|
|
194
|
+
}
|
|
195
|
+
static create(input, duration) {
|
|
196
|
+
return new this(duration).from(input);
|
|
194
197
|
}
|
|
195
198
|
from(input) {
|
|
196
199
|
if (!input) {
|
|
@@ -209,9 +212,6 @@ var Base = class {
|
|
|
209
212
|
this.duration = chapter.startTime;
|
|
210
213
|
}
|
|
211
214
|
}
|
|
212
|
-
if (this.duration === 0) {
|
|
213
|
-
this.duration = 3600;
|
|
214
|
-
}
|
|
215
215
|
this.bump();
|
|
216
216
|
return this;
|
|
217
217
|
}
|
|
@@ -1213,6 +1213,7 @@ var AppleHLS = class extends Base {
|
|
|
1213
1213
|
|
|
1214
1214
|
// src/Formats/Scenecut.ts
|
|
1215
1215
|
var Scenecut = class extends Base {
|
|
1216
|
+
supportsPrettyPrint = true;
|
|
1216
1217
|
filename = "scene-cuts.json";
|
|
1217
1218
|
mimeType = "application/json";
|
|
1218
1219
|
frameRate = 30;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# chapters
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Supported formats:
|
|
6
6
|
|
|
7
7
|
| class | description | key | ext | info |
|
|
8
8
|
|-------------------------------------|------------------------------|----------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
@@ -22,7 +22,7 @@ Create, manage and convert chapters for 17 chapters formats:
|
|
|
22
22
|
| PodloveJson | Podlove Simple Chapters JSON | podlovejson | `json` | [source](https://github.com/podlove/chapters#:~:text=org/%3E-,Encode%20to%20JSON,-iex%3E%20Chapters) |
|
|
23
23
|
| MP4Chaps | MP4Chaps | mp4chaps | `txt` | [source](https://github.com/podlove/chapters#:~:text=%3Achapters%3E-,Encode%20to%20mp4chaps,-iex%3E%20Chapters) |
|
|
24
24
|
| AppleHLS | Apple HLS Chapters | applehls | `json` | [spec](https://developer.apple.com/documentation/http-live-streaming/providing-javascript-object-notation-json-chapters), partial support |
|
|
25
|
-
| Scenecut | Scenecut
|
|
25
|
+
| Scenecut | Scenecut format | scenecut | `json` | [source](https://github.com/slhck/scenecut-extractor#:~:text=cuts%20in%20JSON-,format,-%3A) |
|
|
26
26
|
|
|
27
27
|
## Installation
|
|
28
28
|
|
|
@@ -69,6 +69,10 @@ const vtt2 = Autoformat.as(WebVTT, webVttString) // returns an instance of WebVT
|
|
|
69
69
|
|
|
70
70
|
All formats support the following methods:
|
|
71
71
|
|
|
72
|
+
### `constructor (duration: number = 3600)`
|
|
73
|
+
|
|
74
|
+
Creates a new instance of the class, optionally with a duration in seconds.
|
|
75
|
+
|
|
72
76
|
### `static create (input?: string | MediaItem): MediaItem`
|
|
73
77
|
|
|
74
78
|
Creates a new media item. This is the suggested way to create a media item:
|