Podcast episode downloader, update podcast data model

This commit is contained in:
advplyr 2022-03-21 19:24:38 -05:00
parent 28d76d21f1
commit 920ca683b9
19 changed files with 407 additions and 49 deletions

View file

@ -176,9 +176,11 @@ class Book {
return this.metadata.setDataFromAudioMetaTags(audioFile.metaTags, overrideExistingDetails)
}
setData(scanMediaMetadata) {
setData(mediaPayload) {
this.metadata = new BookMetadata()
this.metadata.setData(scanMediaMetadata)
if (mediaPayload.metadata) {
this.metadata.setData(mediaPayload.metadata)
}
}
// Look for desc.txt, reader.txt, metadata.abs and opf file then update details if found

View file

@ -118,10 +118,14 @@ class Podcast {
return this.episodes[0]
}
setData(metadata, coverPath = null, autoDownload = false) {
this.metadata = new PodcastMetadata(metadata)
this.coverPath = coverPath
this.autoDownloadEpisodes = autoDownload
setData(mediaMetadata) {
this.metadata = new PodcastMetadata()
if (mediaMetadata.metadata) {
this.metadata.setData(mediaMetadata.metadata)
}
this.coverPath = mediaMetadata.coverPath || null
this.autoDownloadEpisodes = !!mediaMetadata.autoDownloadEpisodes
}
async syncMetadataFiles(textMetadataFiles, opfMetadataOverrideDetails) {
@ -150,5 +154,9 @@ class Podcast {
this.episodes.forEach((ep) => total += ep.duration)
return total
}
addPodcastEpisode(podcastEpisode) {
this.episodes.push(podcastEpisode)
}
}
module.exports = Podcast