New api routes, updating web client pages, audiobooks to libraryItem migration

This commit is contained in:
advplyr 2022-03-10 18:45:02 -06:00
parent b97ed953f7
commit 2a30cc428f
51 changed files with 1225 additions and 654 deletions

View file

@ -13,6 +13,7 @@ class BookMetadata {
this.isbn = null
this.asin = null
this.language = null
this.explicit = false
if (metadata) {
this.construct(metadata)
@ -33,6 +34,7 @@ class BookMetadata {
this.isbn = metadata.isbn
this.asin = metadata.asin
this.language = metadata.language
this.explicit = metadata.explicit
}
toJSON() {
@ -49,8 +51,54 @@ class BookMetadata {
description: this.description,
isbn: this.isbn,
asin: this.asin,
language: this.language
language: this.language,
explicit: this.explicit
}
}
toJSONExpanded() {
return {
title: this.title,
subtitle: this.subtitle,
authors: this.authors.map(a => ({ ...a })), // Author JSONMinimal with name and id
narrators: [...this.narrators],
series: this.series.map(s => ({ ...s })),
genres: [...this.genres],
publishedYear: this.publishedYear,
publishedDate: this.publishedDate,
publisher: this.publisher,
description: this.description,
isbn: this.isbn,
asin: this.asin,
language: this.language,
explicit: this.explicit,
authorName: this.authorName,
narratorName: this.narratorName
}
}
get titleIgnorePrefix() {
if (!this.title) return ''
if (this.title.toLowerCase().startsWith('the ')) {
return this.title.substr(4) + ', The'
}
return this.title
}
get authorName() {
return this.authors.map(au => au.name).join(', ')
}
get narratorName() {
return this.narrators.join(', ')
}
hasAuthor(authorName) {
return !!this.authors.find(au => au.name == authorName)
}
hasSeries(seriesName) {
return !!this.series.find(se => se.name == seriesName)
}
hasNarrator(narratorName) {
return this.narrators.includes(narratorName)
}
}
module.exports = BookMetadata