mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-20 13:53:19 +01:00
Add:forceRescan rescans existing audio files,Fix:False positives for if an audio file was updated
This commit is contained in:
@@ -96,9 +96,9 @@ class AudioFile {
|
||||
this.exclude = !!data.exclude
|
||||
this.error = data.error || null
|
||||
|
||||
this.trackNumFromMeta = data.trackNumFromMeta || null
|
||||
this.trackNumFromFilename = data.trackNumFromFilename || null
|
||||
this.cdNumFromFilename = data.cdNumFromFilename || null
|
||||
this.trackNumFromMeta = data.trackNumFromMeta
|
||||
this.trackNumFromFilename = data.trackNumFromFilename
|
||||
this.cdNumFromFilename = data.cdNumFromFilename
|
||||
|
||||
this.format = data.format
|
||||
this.duration = data.duration
|
||||
@@ -130,9 +130,9 @@ class AudioFile {
|
||||
this.fullPath = data.fullPath
|
||||
this.addedAt = Date.now()
|
||||
|
||||
this.trackNumFromMeta = data.trackNumFromMeta || null
|
||||
this.trackNumFromFilename = data.trackNumFromFilename || null
|
||||
this.cdNumFromFilename = data.cdNumFromFilename || null
|
||||
this.trackNumFromMeta = data.trackNumFromMeta
|
||||
this.trackNumFromFilename = data.trackNumFromFilename
|
||||
this.cdNumFromFilename = data.cdNumFromFilename
|
||||
|
||||
this.manuallyVerified = !!data.manuallyVerified
|
||||
this.invalid = !!data.invalid
|
||||
@@ -302,9 +302,9 @@ class AudioFile {
|
||||
hasUpdated = true
|
||||
}
|
||||
} else if (this[key] !== newjson[key]) {
|
||||
// console.log(this.filename, 'key', key, 'updated', this[key], newjson[key])
|
||||
this[key] = newjson[key]
|
||||
hasUpdated = true
|
||||
// console.log('key', key, 'updated', this[key], newjson[key])
|
||||
}
|
||||
}
|
||||
return hasUpdated
|
||||
|
||||
@@ -542,10 +542,9 @@ class Audiobook {
|
||||
var alreadyHasDescTxt = otherFilenamesAlreadyInBook.includes('desc.txt')
|
||||
var alreadyHasReaderTxt = otherFilenamesAlreadyInBook.includes('reader.txt')
|
||||
|
||||
// Filter out other files no longer in directory
|
||||
var newOtherFilePaths = newOtherFiles.map(f => f.path)
|
||||
this.otherFiles = this.otherFiles.filter(f => newOtherFilePaths.includes(f.path))
|
||||
|
||||
// Some files are not there anymore and filtered out
|
||||
if (currOtherFileNum !== this.otherFiles.length) {
|
||||
Logger.debug(`[Audiobook] ${currOtherFileNum - this.otherFiles.length} other files were removed for "${this.title}"`)
|
||||
hasUpdates = true
|
||||
@@ -937,6 +936,8 @@ class Audiobook {
|
||||
|
||||
var newAudioFileData = []
|
||||
var newOtherFileData = []
|
||||
var existingAudioFileData = []
|
||||
var existingOtherFileData = []
|
||||
|
||||
dataFound.audioFiles.forEach((af) => {
|
||||
var audioFileFoundCheck = this.checkFileFound(af, true)
|
||||
@@ -944,6 +945,9 @@ class Audiobook {
|
||||
newAudioFileData.push(af)
|
||||
} else if (audioFileFoundCheck) {
|
||||
hasUpdated = true
|
||||
existingAudioFileData.push(af)
|
||||
} else {
|
||||
existingAudioFileData.push(af)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -953,6 +957,9 @@ class Audiobook {
|
||||
newOtherFileData.push(otherFileData)
|
||||
} else if (fileFoundCheck) {
|
||||
hasUpdated = true
|
||||
existingOtherFileData.push(otherFileData)
|
||||
} else {
|
||||
existingOtherFileData.push(otherFileData)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1010,7 +1017,9 @@ class Audiobook {
|
||||
newAudioFileData,
|
||||
newOtherFileData,
|
||||
audioFilesRemoved,
|
||||
otherFilesRemoved
|
||||
otherFilesRemoved,
|
||||
existingAudioFileData, // Existing file data may get re-scanned if forceRescan is set
|
||||
existingOtherFileData
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user