mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-04 02:05:06 +02:00
Add:Abridged book detail, parse from audible, abridged book filter #1408
This commit is contained in:
parent
7181df0479
commit
fd58df4729
20 changed files with 78 additions and 17 deletions
|
@ -17,6 +17,7 @@ class BookMetadata {
|
|||
this.asin = null
|
||||
this.language = null
|
||||
this.explicit = false
|
||||
this.abridged = false
|
||||
|
||||
if (metadata) {
|
||||
this.construct(metadata)
|
||||
|
@ -38,6 +39,7 @@ class BookMetadata {
|
|||
this.asin = metadata.asin
|
||||
this.language = metadata.language
|
||||
this.explicit = !!metadata.explicit
|
||||
this.abridged = !!metadata.abridged
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
|
@ -55,7 +57,8 @@ class BookMetadata {
|
|||
isbn: this.isbn,
|
||||
asin: this.asin,
|
||||
language: this.language,
|
||||
explicit: this.explicit
|
||||
explicit: this.explicit,
|
||||
abridged: this.abridged
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +79,8 @@ class BookMetadata {
|
|||
isbn: this.isbn,
|
||||
asin: this.asin,
|
||||
language: this.language,
|
||||
explicit: this.explicit
|
||||
explicit: this.explicit,
|
||||
abridged: this.abridged
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +104,8 @@ class BookMetadata {
|
|||
authorName: this.authorName,
|
||||
authorNameLF: this.authorNameLF,
|
||||
narratorName: this.narratorName,
|
||||
seriesName: this.seriesName
|
||||
seriesName: this.seriesName,
|
||||
abridged: this.abridged
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class Audible {
|
|||
}
|
||||
|
||||
cleanResult(item) {
|
||||
const { title, subtitle, asin, authors, narrators, publisherName, summary, releaseDate, image, genres, seriesPrimary, seriesSecondary, language, runtimeLengthMin } = item
|
||||
const { title, subtitle, asin, authors, narrators, publisherName, summary, releaseDate, image, genres, seriesPrimary, seriesSecondary, language, runtimeLengthMin, formatType } = item
|
||||
|
||||
const series = []
|
||||
if (seriesPrimary) {
|
||||
|
@ -54,7 +54,8 @@ class Audible {
|
|||
language: language ? language.charAt(0).toUpperCase() + language.slice(1) : null,
|
||||
duration: runtimeLengthMin && !isNaN(runtimeLengthMin) ? Number(runtimeLengthMin) : 0,
|
||||
region: item.region || null,
|
||||
rating: item.rating || null
|
||||
rating: item.rating || null,
|
||||
abridged: formatType === 'abridged'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -793,7 +793,7 @@ class Scanner {
|
|||
|
||||
async quickMatchBookBuildUpdatePayload(libraryItem, matchData, options) {
|
||||
// Update media metadata if not set OR overrideDetails flag
|
||||
const detailKeysToUpdate = ['title', 'subtitle', 'description', 'narrator', 'publisher', 'publishedYear', 'genres', 'tags', 'language', 'explicit', 'asin', 'isbn']
|
||||
const detailKeysToUpdate = ['title', 'subtitle', 'description', 'narrator', 'publisher', 'publishedYear', 'genres', 'tags', 'language', 'explicit', 'abridged', 'asin', 'isbn']
|
||||
const updatePayload = {}
|
||||
updatePayload.metadata = {}
|
||||
|
||||
|
|
|
@ -121,6 +121,10 @@ const bookMetadataMapper = {
|
|||
explicit: {
|
||||
to: (m) => m.explicit ? 'Y' : 'N',
|
||||
from: (v) => v && v.toLowerCase() == 'y'
|
||||
},
|
||||
abridged: {
|
||||
to: (m) => m.abridged ? 'Y' : 'N',
|
||||
from: (v) => v && v.toLowerCase() == 'y'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ module.exports.reqSupportsWebp = (req) => {
|
|||
module.exports.areEquivalent = areEquivalent
|
||||
|
||||
module.exports.copyValue = (val) => {
|
||||
if (!val) return null
|
||||
if (!val) return val === false ? false : null
|
||||
if (!this.isObject(val)) return val
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
|
|
|
@ -67,6 +67,8 @@ module.exports = {
|
|||
filtered = filtered.filter(li => li.hasIssues)
|
||||
} else if (filterBy === 'feed-open') {
|
||||
filtered = filtered.filter(li => feedsArray.some(feed => feed.entityId === li.id))
|
||||
} else if (filterBy === 'abridged') {
|
||||
filtered = filtered.filter(li => !!li.media.metadata?.abridged)
|
||||
}
|
||||
|
||||
return filtered
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue