diff --git a/client/components/modals/libraries/LibraryItem.vue b/client/components/modals/libraries/LibraryItem.vue
index a6fa5118..60839c3b 100644
--- a/client/components/modals/libraries/LibraryItem.vue
+++ b/client/components/modals/libraries/LibraryItem.vue
@@ -10,6 +10,7 @@
{{ library.name }}
Scan
+ Force Re-Scan
edit
delete
@@ -67,6 +68,9 @@ export default {
scan() {
this.$root.socket.emit('scan', this.library.id)
},
+ forceScan() {
+ this.$root.socket.emit('scan', this.library.id, {forceRescan: true})
+ },
deleteClick() {
if (this.isMain) return
if (confirm(`Are you sure you want to permanently delete library "${this.library.name}"?`)) {
diff --git a/server/Server.js b/server/Server.js
index 5fd1638f..09dd4b63 100644
--- a/server/Server.js
+++ b/server/Server.js
@@ -316,9 +316,9 @@ class Server {
await this.scanner2.scanFilesChanged(fileUpdates)
}
- async scan(libraryId) {
+ async scan(libraryId, options = {}) {
Logger.info('[Server] Starting Scan')
- await this.scanner2.scan(libraryId)
+ await this.scanner2.scan(libraryId, options)
// await this.scanner.scan(libraryId)
Logger.info('[Server] Scan complete')
}
diff --git a/server/scanner/Scanner.js b/server/scanner/Scanner.js
index 40df4eb2..d5bd38d0 100644
--- a/server/scanner/Scanner.js
+++ b/server/scanner/Scanner.js
@@ -221,7 +221,7 @@ class Scanner {
}
} else {
var checkRes = audiobook.checkScanData(dataFound, version)
- if (checkRes.newAudioFileData.length || checkRes.newOtherFileData.length) { // Audiobook has new files
+ if (checkRes.newAudioFileData.length || checkRes.newOtherFileData.length || libraryScan.scanOptions.forceRescan) { // Audiobook has new files
checkRes.audiobook = audiobook
checkRes.bookScanData = dataFound
audiobookDataToRescan.push(checkRes)
@@ -325,13 +325,13 @@ class Scanner {
libraryScan.addLog(LogLevel.DEBUG, `Library "${libraryScan.libraryName}" Re-scanning "${audiobook.path}"`)
// Sync other files first to use local images as cover before extracting audio file cover
- if (newOtherFileData.length) {
+ if (newOtherFileData.length || libraryScan.scanOptions.forceRescan) {
// TODO: Cleanup other file sync
var allOtherFiles = newOtherFileData.concat(audiobook._otherFiles)
await audiobook.syncOtherFiles(allOtherFiles, this.MetadataPath, libraryScan.preferOpfMetadata)
}
- if (newAudioFileData.length) {
+ if (newAudioFileData.length || libraryScan.scanOptions.forceRescan) {
await AudioFileScanner.scanAudioFiles(newAudioFileData, bookScanData, audiobook, libraryScan.preferAudioMetadata, libraryScan)
// Extract embedded cover art if cover is not already in directory