@mtillmann/chapters 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +29 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtillmann/chapters",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "library that manages and converts chapters of multiple formats",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/readme.md CHANGED
@@ -1,8 +1,14 @@
1
1
  ![tests](https://github.com/Mtillmann/chapters/actions/workflows/tests.yaml/badge.svg?event=push)
2
2
 
3
+ [![npm version](https://badge.fury.io/js/@mtillmann%2Fchapters.svg)](https://badge.fury.io/js/@mtillmann%2Fchapters)
4
+
3
5
  # chapters
4
6
 
5
- Supported formats:
7
+ This is the core library of the [chaptertool](https://github.com/Mtillmann/chaptertool) project and provides the functionality to handle the formats below.
8
+
9
+ [Click here to open the web GUI](https://mtillmann.github.io/chaptertool) or go install chaptertool locally for CLI use.
10
+
11
+ ## Supported formats
6
12
 
7
13
  | class | description | key | ext | info |
8
14
  |-------------------------------------|------------------------------|----------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -73,9 +79,24 @@ All formats support the following methods:
73
79
 
74
80
  Creates a new instance of the class, optionally with a duration in seconds.
75
81
 
82
+ ```javascript
83
+ const chapters = (new ChaptersJson(3600)).from(input)
84
+ ```
85
+
86
+ > the constructor will not accept any input due to javascript's order of initialization which prevents the parse method
87
+ > from having access to cerain locally defined properties and methods.
88
+
76
89
  ### `static create (input?: string | MediaItem): MediaItem`
77
90
 
78
- Creates a new media item. This is the suggested way to create a media item:
91
+ Creates a new media item. This is the suggested way to create a media item from a string:
92
+
93
+ ```javascript
94
+ const chapters = MatroskaXML.create(input)
95
+ // chapters is now an instance of MatroskaXML
96
+
97
+ const chapterString = WebVTT.create(chapters).toString()
98
+ // chapterString is now a string representation of the chapters
99
+ ```
79
100
 
80
101
  ### `from (input?: string | MediaItem): MediaItem`
81
102
 
@@ -135,11 +156,11 @@ Returns the index of the chapter at the given time.
135
156
 
136
157
  ### `toString([pretty: boolean][, options: object]): string`
137
158
 
138
- Convert the chapters to a string.
159
+ Convert the chapters to a string.
139
160
  If `pretty` is `true`, the output will be formatted for better readability. Only supported by `json` and `xml` formats.
140
- `options` is an optional argument, containing format specific, optional options:
161
+ Some formats support additional options:
141
162
 
142
- #### ChapterJson
163
+ #### ChapterJson toString() options
143
164
 
144
165
  | option | type | default | description |
145
166
  |---------------------|-----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -147,20 +168,20 @@ If `pretty` is `true`, the output will be formatted for better readability. Only
147
168
  | `writeRedundantToc` | `boolean` | `false` | Write [redundant](https://github.com/Podcastindex-org/podcast-namespace/blob/main/chapters/jsonChapters.md#:~:text=or%20not%20present%20at%20all) TOC attributes |
148
169
  | `writeEndTimes` | `boolean` | `false` | Write end times |
149
170
 
150
- #### AppleChapters
171
+ #### AppleChapters toString() options
151
172
 
152
173
  | option | type | default | description |
153
174
  |-----------------|-----------|---------|-----------------------------------------------------------|
154
175
  | `acUseTextAttr` | `boolean` | `false` | When set, the text-attribute will be used instead of node textContent |
155
176
 
156
- #### PySceneDetect
177
+ #### PySceneDetect toString() options
157
178
 
158
179
  | option | type | default | description |
159
180
  |--------------------|----------|----------|------------------------------------------|
160
181
  | `psdFramerate` | `number` | `23.976` | Framerate of the video file |
161
182
  | `psdOmitTimecodes` | `boolen` | `false` | When set, the first line will be omitted |
162
183
 
163
- #### Scenecut
184
+ #### Scenecut toString() options
164
185
 
165
186
  | option | type | default | description |
166
187
  |--------|----------|---------|-----------------------------|