Add download queue

This commit is contained in:
mfcar 2023-02-27 02:56:07 +00:00
parent f0edea5d52
commit 34ac972130
No known key found for this signature in database
21 changed files with 359 additions and 22 deletions

View file

@ -8,6 +8,7 @@ class PodcastEpisodeDownload {
this.podcastEpisode = null
this.url = null
this.libraryItem = null
this.libraryId = null
this.isAutoDownload = false
this.isDownloading = false
@ -25,12 +26,17 @@ class PodcastEpisodeDownload {
episodeDisplayTitle: this.podcastEpisode ? this.podcastEpisode.title : null,
url: this.url,
libraryItemId: this.libraryItem ? this.libraryItem.id : null,
libraryId: this.libraryId || null,
isDownloading: this.isDownloading,
isFinished: this.isFinished,
failed: this.failed,
startedAt: this.startedAt,
createdAt: this.createdAt,
finishedAt: this.finishedAt
finishedAt: this.finishedAt,
season: this.podcastEpisode ? this.podcastEpisode.season : null,
episode: this.podcastEpisode ? this.podcastEpisode.episode : null,
episodeType: this.podcastEpisode ? this.podcastEpisode.episodeType : 'full',
publishedAt: this.podcastEpisode ? this.podcastEpisode.publishedAt : null
}
}
@ -47,13 +53,14 @@ class PodcastEpisodeDownload {
return this.libraryItem ? this.libraryItem.id : null
}
setData(podcastEpisode, libraryItem, isAutoDownload) {
setData(podcastEpisode, libraryItem, isAutoDownload, libraryId) {
this.id = getId('epdl')
this.podcastEpisode = podcastEpisode
this.url = encodeURI(podcastEpisode.enclosure.url)
this.libraryItem = libraryItem
this.isAutoDownload = isAutoDownload
this.createdAt = Date.now()
this.libraryId = libraryId
}
setFinished(success) {
@ -62,4 +69,4 @@ class PodcastEpisodeDownload {
this.failed = !success
}
}
module.exports = PodcastEpisodeDownload
module.exports = PodcastEpisodeDownload