Add:Podcast auto-download option to delete an episode if it exceeds X max episodes to keep #903

This commit is contained in:
advplyr 2022-08-15 17:35:13 -05:00
parent 2c0c53bbf1
commit 7a69afdcd9
6 changed files with 85 additions and 14 deletions

View file

@ -19,6 +19,7 @@ class Podcast {
this.autoDownloadEpisodes = false
this.lastEpisodeCheck = 0
this.maxEpisodesToKeep = 0
this.lastCoverSearch = null
this.lastCoverSearchQuery = null
@ -40,6 +41,7 @@ class Podcast {
})
this.autoDownloadEpisodes = !!podcast.autoDownloadEpisodes
this.lastEpisodeCheck = podcast.lastEpisodeCheck || 0
this.maxEpisodesToKeep = podcast.maxEpisodesToKeep || 0
}
toJSON() {
@ -50,7 +52,8 @@ class Podcast {
tags: [...this.tags],
episodes: this.episodes.map(e => e.toJSON()),
autoDownloadEpisodes: this.autoDownloadEpisodes,
lastEpisodeCheck: this.lastEpisodeCheck
lastEpisodeCheck: this.lastEpisodeCheck,
maxEpisodesToKeep: this.maxEpisodesToKeep
}
}
@ -62,6 +65,7 @@ class Podcast {
numEpisodes: this.episodes.length,
autoDownloadEpisodes: this.autoDownloadEpisodes,
lastEpisodeCheck: this.lastEpisodeCheck,
maxEpisodesToKeep: this.maxEpisodesToKeep,
size: this.size
}
}
@ -75,6 +79,7 @@ class Podcast {
episodes: this.episodes.map(e => e.toJSONExpanded()),
autoDownloadEpisodes: this.autoDownloadEpisodes,
lastEpisodeCheck: this.lastEpisodeCheck,
maxEpisodesToKeep: this.maxEpisodesToKeep,
size: this.size
}
}
@ -113,6 +118,9 @@ class Podcast {
})
return largestPublishedAt
}
get episodesWithPubDate() {
return this.episodes.filter(ep => !!ep.publishedAt)
}
update(payload) {
var json = this.toJSON()