mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-19 02:14:31 +02:00
New data model save covers, scanner, new api routes
This commit is contained in:
parent
5f4e5cd3d8
commit
73257188f6
37 changed files with 1649 additions and 672 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue