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

@ -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