mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-02 13:34:53 +02:00
Add:New scanner and scanner server settings
This commit is contained in:
parent
bf11d266dc
commit
a5fc382cad
17 changed files with 681 additions and 176 deletions
|
@ -43,6 +43,7 @@ class Book {
|
|||
get _genres() { return this.genres || [] }
|
||||
|
||||
get shouldSearchForCover() {
|
||||
if (this.cover) return false
|
||||
if (this.authorFL !== this.lastCoverSearchAuthor || this.title !== this.lastCoverSearchTitle || !this.lastCoverSearch) return true
|
||||
var timeSinceLastSearch = Date.now() - this.lastCoverSearch
|
||||
return timeSinceLastSearch > 1000 * 60 * 60 * 24 * 7 // every 7 days do another lookup
|
||||
|
@ -297,7 +298,7 @@ class Book {
|
|||
return [genreTag]
|
||||
}
|
||||
|
||||
setDetailsFromFileMetadata(audioFileMetadata) {
|
||||
setDetailsFromFileMetadata(audioFileMetadata, overrideExistingDetails = false) {
|
||||
const MetadataMapArray = [
|
||||
{
|
||||
tag: 'tagComposer',
|
||||
|
@ -319,6 +320,10 @@ class Book {
|
|||
tag: 'tagSubtitle',
|
||||
key: 'subtitle'
|
||||
},
|
||||
{
|
||||
tag: 'tagAlbum',
|
||||
key: 'title',
|
||||
},
|
||||
{
|
||||
tag: 'tagArtist',
|
||||
key: 'author'
|
||||
|
@ -342,12 +347,12 @@ class Book {
|
|||
MetadataMapArray.forEach((mapping) => {
|
||||
if (audioFileMetadata[mapping.tag]) {
|
||||
// Genres can contain multiple
|
||||
if (mapping.key === 'genres' && (!this[mapping.key].length || !this[mapping.key])) {
|
||||
if (mapping.key === 'genres' && (!this[mapping.key].length || !this[mapping.key] || overrideExistingDetails)) {
|
||||
updatePayload[mapping.key] = this.parseGenresTag(audioFileMetadata[mapping.tag])
|
||||
Logger.debug(`[Book] Mapping metadata to key ${mapping.tag} => ${mapping.key}: ${updatePayload[mapping.key].join(',')}`)
|
||||
} else if (!this[mapping.key]) {
|
||||
// Logger.debug(`[Book] Mapping metadata to key ${mapping.tag} => ${mapping.key}: ${updatePayload[mapping.key].join(',')}`)
|
||||
} else if (!this[mapping.key] || overrideExistingDetails) {
|
||||
updatePayload[mapping.key] = audioFileMetadata[mapping.tag]
|
||||
Logger.debug(`[Book] Mapping metadata to key ${mapping.tag} => ${mapping.key}: ${updatePayload[mapping.key]}`)
|
||||
// Logger.debug(`[Book] Mapping metadata to key ${mapping.tag} => ${mapping.key}: ${updatePayload[mapping.key]}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue