Change new podcast modal to remove episode download list #494, Fix error when importing many episodes (set max size to 5MB) #493, show podcast episodes downloading and in queue on podcast landing page

This commit is contained in:
advplyr 2022-04-23 19:41:06 -05:00
parent ebc9e1a888
commit 034d858f18
14 changed files with 222 additions and 126 deletions

View file

@ -10,22 +10,42 @@ class PodcastEpisodeDownload {
this.libraryItem = null
this.isDownloading = false
this.isFinished = false
this.failed = false
this.startedAt = null
this.createdAt = null
this.finishedAt = null
}
toJSONForClient() {
return {
id: this.id,
// podcastEpisode: this.podcastEpisode ? this.podcastEpisode.toJSON() : null,
episodeDisplayTitle: this.podcastEpisode ? this.podcastEpisode.bestFilename : null,
url: this.url,
libraryItemId: this.libraryItem ? this.libraryItem.id : null,
isDownloading: this.isDownloading,
isFinished: this.isFinished,
failed: this.failed,
startedAt: this.startedAt,
createdAt: this.createdAt,
finishedAt: this.finishedAt
}
}
get targetFilename() {
return sanitizeFilename(`${this.podcastEpisode.bestFilename}.mp3`)
}
get targetPath() {
return Path.join(this.libraryItem.path, this.targetFilename)
}
get targetRelPath() {
return this.targetFilename
}
get libraryItemId() {
return this.libraryItem ? this.libraryItem.id : null
}
setData(podcastEpisode, libraryItem) {
this.id = getId('epdl')
@ -34,5 +54,11 @@ class PodcastEpisodeDownload {
this.libraryItem = libraryItem
this.createdAt = Date.now()
}
setFinished(success) {
this.finishedAt = Date.now()
this.isFinished = true
this.failed = !success
}
}
module.exports = PodcastEpisodeDownload