mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-02 17:24:57 +02:00
Update:Remove scanner settings, add library scanner settings tab, add order of precedence
This commit is contained in:
parent
5ad9f507ba
commit
347b49f564
35 changed files with 764 additions and 809 deletions
|
@ -25,7 +25,7 @@ class LibraryItemScanData {
|
|||
this.relPath = data.relPath
|
||||
/** @type {boolean} */
|
||||
this.isFile = data.isFile
|
||||
/** @type {{author:string, title:string, subtitle:string, series:string, sequence:string, publishedYear:string, narrators:string}} */
|
||||
/** @type {import('../utils/scandir').LibraryItemFilenameMetadata} */
|
||||
this.mediaMetadata = data.mediaMetadata
|
||||
/** @type {import('../objects/files/LibraryFile')[]} */
|
||||
this.libraryFiles = data.libraryFiles
|
||||
|
@ -233,10 +233,9 @@ class LibraryItemScanData {
|
|||
}
|
||||
await existingLibraryItem.save()
|
||||
return true
|
||||
} else {
|
||||
libraryScan.addLog(LogLevel.DEBUG, `Library item "${existingLibraryItem.relPath}" is up-to-date`)
|
||||
return false
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -303,5 +302,34 @@ class LibraryItemScanData {
|
|||
|
||||
return !this.ebookLibraryFiles.some(lf => lf.ino === ebookFile.ino)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set data parsed from filenames
|
||||
*
|
||||
* @param {Object} bookMetadata
|
||||
*/
|
||||
setBookMetadataFromFilenames(bookMetadata) {
|
||||
const keysToMap = ['title', 'subtitle', 'publishedYear']
|
||||
for (const key in this.mediaMetadata) {
|
||||
if (keysToMap.includes(key) && this.mediaMetadata[key]) {
|
||||
bookMetadata[key] = this.mediaMetadata[key]
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mediaMetadata.authors?.length) {
|
||||
bookMetadata.authors = this.mediaMetadata.authors
|
||||
}
|
||||
if (this.mediaMetadata.narrators?.length) {
|
||||
bookMetadata.narrators = this.mediaMetadata.narrators
|
||||
}
|
||||
if (this.mediaMetadata.seriesName) {
|
||||
bookMetadata.series = [
|
||||
{
|
||||
name: this.mediaMetadata.seriesName,
|
||||
sequence: this.mediaMetadata.seriesSequence || null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = LibraryItemScanData
|
Loading…
Add table
Add a link
Reference in a new issue