mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-16 01:57:48 +02:00
New data model save covers, scanner, new api routes
This commit is contained in:
@ -12,6 +12,9 @@ class FileMetadata {
|
||||
if (metadata) {
|
||||
this.construct(metadata)
|
||||
}
|
||||
|
||||
// Temp flag used in scans
|
||||
this.wasModified = false
|
||||
}
|
||||
|
||||
construct(metadata) {
|
||||
@ -46,5 +49,24 @@ class FileMetadata {
|
||||
if (!this.ext) return ''
|
||||
return this.ext.slice(1)
|
||||
}
|
||||
|
||||
update(payload) {
|
||||
var hasUpdates = false
|
||||
for (const key in payload) {
|
||||
if (this[key] !== undefined && this[key] !== payload[key]) {
|
||||
this[key] = payload[key]
|
||||
hasUpdates = true
|
||||
}
|
||||
}
|
||||
return hasUpdates
|
||||
}
|
||||
|
||||
setData(payload) {
|
||||
for (const key in payload) {
|
||||
if (this[key] !== undefined) {
|
||||
this[key] = payload[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = FileMetadata
|
Reference in New Issue
Block a user