mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-04 10:14:36 +02:00
Add podcast episode auto download new episodes cron
This commit is contained in:
parent
d5e96a3422
commit
0dd219f303
10 changed files with 155 additions and 15 deletions
|
@ -126,5 +126,10 @@ class PodcastEpisode {
|
|||
audioTrack.setData(libraryItemId, this.audioFile, 0)
|
||||
return [audioTrack]
|
||||
}
|
||||
|
||||
checkEqualsEnclosureUrl(url) {
|
||||
if (!this.enclosure || !this.enclosure.url) return false
|
||||
return this.enclosure.url == url
|
||||
}
|
||||
}
|
||||
module.exports = PodcastEpisode
|
|
@ -15,6 +15,7 @@ class Podcast {
|
|||
this.episodes = []
|
||||
|
||||
this.autoDownloadEpisodes = false
|
||||
this.lastEpisodeCheck = 0
|
||||
|
||||
this.lastCoverSearch = null
|
||||
this.lastCoverSearchQuery = null
|
||||
|
@ -30,6 +31,7 @@ class Podcast {
|
|||
this.tags = [...podcast.tags]
|
||||
this.episodes = podcast.episodes.map((e) => new PodcastEpisode(e))
|
||||
this.autoDownloadEpisodes = !!podcast.autoDownloadEpisodes
|
||||
this.lastEpisodeCheck = podcast.lastEpisodeCheck || 0
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
|
@ -38,7 +40,8 @@ class Podcast {
|
|||
coverPath: this.coverPath,
|
||||
tags: [...this.tags],
|
||||
episodes: this.episodes.map(e => e.toJSON()),
|
||||
autoDownloadEpisodes: this.autoDownloadEpisodes
|
||||
autoDownloadEpisodes: this.autoDownloadEpisodes,
|
||||
lastEpisodeCheck: this.lastEpisodeCheck
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +52,7 @@ class Podcast {
|
|||
tags: [...this.tags],
|
||||
episodes: this.episodes.map(e => e.toJSON()),
|
||||
autoDownloadEpisodes: this.autoDownloadEpisodes,
|
||||
lastEpisodeCheck: this.lastEpisodeCheck,
|
||||
size: this.size
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +64,7 @@ class Podcast {
|
|||
tags: [...this.tags],
|
||||
episodes: this.episodes.map(e => e.toJSONExpanded()),
|
||||
autoDownloadEpisodes: this.autoDownloadEpisodes,
|
||||
lastEpisodeCheck: this.lastEpisodeCheck,
|
||||
size: this.size
|
||||
}
|
||||
}
|
||||
|
@ -135,6 +140,7 @@ class Podcast {
|
|||
|
||||
this.coverPath = mediaMetadata.coverPath || null
|
||||
this.autoDownloadEpisodes = !!mediaMetadata.autoDownloadEpisodes
|
||||
this.lastEpisodeCheck = Date.now() // Makes sure new episodes are after this
|
||||
}
|
||||
|
||||
async syncMetadataFiles(textMetadataFiles, opfMetadataOverrideDetails) {
|
||||
|
@ -149,6 +155,9 @@ class Podcast {
|
|||
checkHasEpisode(episodeId) {
|
||||
return this.episodes.some(ep => ep.id === episodeId)
|
||||
}
|
||||
checkHasEpisodeByFeedUrl(url) {
|
||||
return this.episodes.some(ep => ep.checkEqualsEnclosureUrl(url))
|
||||
}
|
||||
|
||||
// Only checks container format
|
||||
checkCanDirectPlay(payload, episodeId) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue