Skip to content

Commit

Permalink
updated readme and bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Mtillmann committed Mar 11, 2024
1 parent 81a6fdc commit a264706
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mtillmann/chapters",
"version": "0.1.1",
"version": "0.1.2",
"description": "library that manages and converts chapters of multiple formats",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
29 changes: 22 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,24 @@ All formats support the following methods:

Creates a new instance of the class, optionally with a duration in seconds.

```javascript
const chapters = (new ChaptersJson(3600)).from(input)
```

> the constructor will not accept any input due to javascript's order of initialization which prevents the parse method
> from having access to cerain locally defined properties and methods.
### `static create (input?: string | MediaItem): MediaItem`

Creates a new media item. This is the suggested way to create a media item:
Creates a new media item. This is the suggested way to create a media item from a string:

```javascript
const chapters = MatroskaXML.create(input)
// chapters is now an instance of MatroskaXML

const chapterString = WebVTT.create(chapters).toString()
// chapterString is now a string representation of the chapters
```

### `from (input?: string | MediaItem): MediaItem`

Expand Down Expand Up @@ -141,32 +156,32 @@ Returns the index of the chapter at the given time.

### `toString([pretty: boolean][, options: object]): string`

Convert the chapters to a string.
Convert the chapters to a string.
If `pretty` is `true`, the output will be formatted for better readability. Only supported by `json` and `xml` formats.
`options` is an optional argument, containing format specific, optional options:
Some formats support additional options:

#### ChapterJson
#### ChapterJson toString() options

| option | type | default | description |
|---------------------|-----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `imagePrefix` | `string` | `''` | Prefix for image URLs |
| `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 |
| `writeEndTimes` | `boolean` | `false` | Write end times |

#### AppleChapters
#### AppleChapters toString() options

| option | type | default | description |
|-----------------|-----------|---------|-----------------------------------------------------------|
| `acUseTextAttr` | `boolean` | `false` | When set, the text-attribute will be used instead of node textContent |

#### PySceneDetect
#### PySceneDetect toString() options

| option | type | default | description |
|--------------------|----------|----------|------------------------------------------|
| `psdFramerate` | `number` | `23.976` | Framerate of the video file |
| `psdOmitTimecodes` | `boolen` | `false` | When set, the first line will be omitted |

#### Scenecut
#### Scenecut toString() options

| option | type | default | description |
|--------|----------|---------|-----------------------------|
Expand Down

0 comments on commit a264706

Please sign in to comment.