Skip to content

Commit

Permalink
Merge pull request #14 from etopeter/podcast-refactor
Browse files Browse the repository at this point in the history
feat: Podcasts templates for single page view
  • Loading branch information
etopeter authored Jan 21, 2023
2 parents 0b781c5 + b538070 commit 9473601
Show file tree
Hide file tree
Showing 16 changed files with 13,059 additions and 339 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Changing page prefix/postfix will create new pages and existing pages will need
- Import and update separate pages.
- Choose items to import based on progress filter (eg. finished, in progress)
- Update existing items. Toggle update wtih audiobookshelfUpdateEnabled property per item to disable.
- Podcasts Import to a single page

## Documentation
- [Templates](docs/templates.md)
Expand Down
147 changes: 106 additions & 41 deletions docs/templates.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
# Standard template
Example template that can be used to render Audiobookshelf item. Only single block will be created from this template.
# Standard Book template
Example template that can be used to render Audiobookshelf Book item. Only single block will be created from this template.

NOTE
> Description field may contain a lot of text.
```
### books/{{{title}}}
collapsed:: false
subtitle:: {{subtitle}}
progress:: {{{progress}}}
isFinished:: {{{isFinished}}}
duration:: {{{duration}}}
currentTime:: {{{currentTime}}}
{{!===== Authors =====}}
{{#authors.length}}
authors:: {{#authors}}[[{{{name}}}]]{{/authors}}
{{/authors.length}}
{{!===== Narrators =====}}
{{#narrators.length}}
narrators:: {{#narrators}}[[{{{.}}}]]{{/narrators}}
{{/narrators.length}}
{{!===== Genres =====}}
{{#genres.length}}
genres:: {{#genres}}[[{{{.}}}]]{{/genres}}
{{/genres.length}}
{{!===== Series =====}}
{{#series}}
series:: {{#series}}[[{{{name}}}]]{{/series}}
{{/series}}
source:: [Open in Audiobookshelf]({{{audiobookshelfUrl}}})
asin:: {{{asin}}}
isbn:: {{{isbn}}}
{{!===== Tags =====}}
{{#tags.length}}
tags:: {{#tags}}[[{{{.}}}]] {{/tags}}
{{/tags.length}}
{{!===== Started Date =====}}
{{#startedDate}}
startedDate:: [[{{{startedDateParsed}}}]]
{{/startedDate}}
{{!===== Finished Date =====}}
{{#finishedDate}}
finishedDate:: [[{{{finishedDateParsed}}}]]
{{/finishedDate}}
{{{description}}}
collapsed:: false
subtitle:: {{subtitle}}
progress:: {{{progress}}}
isFinished:: {{{isFinished}}}
duration:: {{{duration}}}
currentTime:: {{{currentTime}}}
{{!===== Authors =====}}
{{#authors.length}}
authors:: {{#authors}}[[{{{name}}}]]{{/authors}}
{{/authors.length}}
{{!===== Narrators =====}}
{{#narrators.length}}
narrators:: {{#narrators}}[[{{{.}}}]]{{/narrators}}
{{/narrators.length}}
{{!===== Genres =====}}
{{#genres.length}}
genres:: {{#genres}}[[{{{.}}}]]{{/genres}}
{{/genres.length}}
{{!===== Series =====}}
{{#series}}
series:: {{#series}}[[{{{name}}}]]{{/series}}
{{/series}}
source:: [Open in Audiobookshelf]({{{audiobookshelfUrl}}})
asin:: {{{asin}}}
isbn:: {{{isbn}}}
{{!===== Tags =====}}
{{#tags.length}}
tags:: {{#tags}}[[{{{.}}}]] {{/tags}}
{{/tags.length}}
{{!===== Started Date =====}}
{{#startedDate}}
startedDate:: [[{{{startedDateParsed}}}]]
{{/startedDate}}
{{!===== Finished Date =====}}
{{#finishedDate}}
finishedDate:: [[{{{finishedDateParsed}}}]]
{{/finishedDate}}
{{{description}}}
```


Expand Down Expand Up @@ -77,3 +77,68 @@ NOTE
| tags | list[string] | Tags |
| title | string | Item Title |

# Standard Podcast template
Example template that can be used to render Audiobookshelf *Podcast* item. Only single block will be created from this template.

```
### podcasts/{{{title}}}/{{{episodeTitle}}}
collapsed:: false
subtitle:: {{subtitle}}
progress:: {{{progress}}}
isFinished:: {{{isFinished}}}
duration:: {{{duration}}}
currentTime:: {{{currentTime}}}
author:: [[{{{author}}}]]
{{!===== Genres =====}}
{{#genres.length}}
genres:: {{#genres}}[[{{{.}}}]]{{/genres}}
{{/genres.length}}
source:: [Open in Audiobookshelf]({{{audiobookshelfUrl}}})
{{!===== Tags =====}}
{{#tags.length}}
tags:: {{#tags}}[[{{{.}}}]] {{/tags}}
{{/tags.length}}
{{!===== Started Date =====}}
{{#startedDate}}
startedDate:: [[{{{startedDateParsed}}}]]
{{/startedDate}}
{{!===== Finished Date =====}}
{{#finishedDate}}
finishedDate:: [[{{{finishedDateParsed}}}]]
{{/finishedDate}}
{{{description}}}
```

## Available variables

| Variable Name | Type | Description |
|---------------|------|-------------|
| audiobookshelfUrl | string | URL to Audiobookshelf instance with item |
| author | string | Author |
| description | string | Podcast Description |
| duration | string | Duration human readable format|
| currentTime | string | Progress time human readable format|
| isFinished | boolean | Is it finished |
| explicit | boolean | Explicit |
| genres | list[string] | Genres |
| startedDate | string | Date started|
| startedDateParsed | string| Parsed started date|
| finishedDate | string | Date finished |
| finishedDateParsed | string | Parsed fineshed date|
| language | string | Language |
| progress | string | Progress percentage |
| releaseDate | string | Date released |
| tags | list[string] | Tags |
| title | string | Podcast Title |
| episodeTitle | string | Episode Title |
| episodeSubtitle| string | The subtitle of the podcast episode.|
| index | string | Episode Index |
| season | string | The season of the podcast episode, if known. |
| episode | string | The episode of the season of the podcast, if known.|
| episodeType | string | The type of episode that the podcast episode is. |
| episodeDescription | string | Episode Description |
| episodePubDate | string | When the podcast episode was published. |
| episodePublishedAt | number | The time (in ms since POSIX epoch) when the podcast episode was published.|
| episodeAddedAt | number | The time (in ms since POSIX epoch) when the podcast episode was added to the library. |
| episodeUpdatedAt | number | The time (in ms since POSIX epoch) when the podcast episode was last updated.|
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,28 @@
"description": "Audiobookshelf Import",
"license": "MIT",
"dependencies": {
"@logseq/libs": "^0.0.14",
"date-fns": "^2.28.0",
"html-entities": "2.3.3",
"mustache": "^4.2.0",
"pnpm": "^7.25.0"
"pnpm": "^7.25.1"
},
"devDependencies": {
"@logseq/libs": "^0.0.14",
"logseq-dateutils": "^0.0.26",
"parcel": "^2.0.0",
"sweetalert": "^2.1.2",
"@semantic-release/changelog": "6.0.1",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/npm": "9.0.1",
"semantic-release": "^19.0.0",
"@types/jest": "^29.0.3",
"@types/mustache": "^4.2.2",
"conventional-changelog-conventionalcommits": "5.0.0",
"prettier": "^2.8.3",
"jest": "^29.0.3",
"ts-jest": "^29.0.5",
"jest-fetch-mock": "^3.0.3",
"@types/jest": "^29.0.3",
"logseq-dateutils": "^0.0.26",
"parcel": "^2.0.0",
"prettier": "^2.8.3",
"semantic-release": "^19.0.0",
"sweetalert": "^2.1.2",
"ts-jest": "^29.0.5",
"typescript": "^4.8.3"
},
"browserslist": [
Expand Down
Loading

0 comments on commit 9473601

Please sign in to comment.