Add db migration file to change audiobooks to library items with new data model

This commit is contained in:
advplyr 2022-03-09 19:23:17 -06:00
parent 65793f7109
commit b97ed953f7
17 changed files with 719 additions and 127 deletions

View file

@ -1,4 +1,4 @@
class AudioFileMetadata {
class AudioMetaTags {
constructor(metadata) {
this.tagAlbum = null
this.tagArtist = null
@ -126,4 +126,4 @@ class AudioFileMetadata {
return true
}
}
module.exports = AudioFileMetadata
module.exports = AudioMetaTags

View file

@ -22,12 +22,12 @@ class BookMetadata {
construct(metadata) {
this.title = metadata.title
this.subtitle = metadata.subtitle
this.authors = metadata.authors.map(a => ({ ...a }))
this.narrators = [...metadata.narrators]
this.series = metadata.series.map(s => ({ ...s }))
this.genres = [...metadata.genres]
this.publishedYear = metadata.publishedYear
this.publishedDate = metadata.publishedDate
this.authors = (metadata.authors && metadata.authors.map) ? metadata.authors.map(a => ({ ...a })) : []
this.narrators = metadata.narrators ? [...metadata.narrators] : []
this.series = (metadata.series && metadata.series.map) ? metadata.series.map(s => ({ ...s })) : []
this.genres = metadata.genres ? [...metadata.genres] : []
this.publishedYear = metadata.publishedYear || null
this.publishedDate = metadata.publishedDate || null
this.publisher = metadata.publisher
this.description = metadata.description
this.isbn = metadata.isbn

View file

@ -37,5 +37,9 @@ class FileMetadata {
birthtimeMs: this.birthtimeMs
}
}
clone() {
return new FileMetadata(this.toJSON())
}
}
module.exports = FileMetadata