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

@ -166,8 +166,10 @@ class LibraryItem {
} else {
this.mediaType = 'book'
this.media = new Book()
}
for (const key in payload) {
if (key === 'libraryFiles') {
this.libraryFiles = payload.libraryFiles.map(lf => lf.clone())
@ -175,13 +177,13 @@ class LibraryItem {
// Use first image library file as cover
var firstImageFile = this.libraryFiles.find(lf => lf.fileType === 'image')
if (firstImageFile) this.media.coverPath = firstImageFile.metadata.path
} else if (this[key] !== undefined) {
} else if (this[key] !== undefined && key !== 'media') {
this[key] = payload[key]
}
}
if (payload.mediaMetadata) {
this.media.setData(payload.mediaMetadata)
if (payload.media) {
this.media.setData(payload.media)
}
this.addedAt = Date.now()