Podcast library item card, edit details, batch edit

This commit is contained in:
advplyr 2022-03-26 15:23:25 -05:00
parent 5446aea910
commit e32d05ea27
14 changed files with 395 additions and 244 deletions

View file

@ -59,6 +59,26 @@ class PodcastEpisode {
}
}
toJSONExpanded() {
return {
id: this.id,
index: this.index,
episode: this.episode,
episodeType: this.episodeType,
title: this.title,
subtitle: this.subtitle,
description: this.description,
enclosure: this.enclosure ? { ...this.enclosure } : null,
pubDate: this.pubDate,
audioFile: this.audioFile.toJSON(),
publishedAt: this.publishedAt,
addedAt: this.addedAt,
updatedAt: this.updatedAt,
duration: this.duration,
size: this.size
}
}
get tracks() {
return [this.audioFile]
}

View file

@ -47,7 +47,8 @@ class Podcast {
coverPath: this.coverPath,
tags: [...this.tags],
episodes: this.episodes.map(e => e.toJSON()),
autoDownloadEpisodes: this.autoDownloadEpisodes
autoDownloadEpisodes: this.autoDownloadEpisodes,
size: this.size
}
}
@ -56,8 +57,9 @@ class Podcast {
metadata: this.metadata.toJSONExpanded(),
coverPath: this.coverPath,
tags: [...this.tags],
episodes: this.episodes.map(e => e.toJSON()),
autoDownloadEpisodes: this.autoDownloadEpisodes
episodes: this.episodes.map(e => e.toJSONExpanded()),
autoDownloadEpisodes: this.autoDownloadEpisodes,
size: this.size
}
}

View file

@ -1,3 +1,6 @@
const Logger = require('../../Logger')
const { areEquivalent, copyValue } = require('../../utils/index')
class PodcastMetadata {
constructor(metadata) {
this.title = null
@ -87,5 +90,20 @@ class PodcastMetadata {
this.genres = [...mediaMetadata.genres]
}
}
update(payload) {
var json = this.toJSON()
var hasUpdates = false
for (const key in json) {
if (payload[key] !== undefined) {
if (!areEquivalent(payload[key], json[key])) {
this[key] = copyValue(payload[key])
Logger.debug('[PodcastMetadata] Key updated', key, this[key])
hasUpdates = true
}
}
}
return hasUpdates
}
}
module.exports = PodcastMetadata