mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-13 02:45:02 +02:00
New api routes, updating web client pages, audiobooks to libraryItem migration
This commit is contained in:
parent
b97ed953f7
commit
2a30cc428f
51 changed files with 1225 additions and 654 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue