mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-30 18:48:55 +01:00
Add: Force re-scan library
This commit is contained in:
parent
f6d43ea60f
commit
b68c181631
@ -10,6 +10,7 @@
|
|||||||
<p class="text-xl font-book pl-4 hover:underline cursor-pointer" @click.stop="$emit('click', library)">{{ library.name }}</p>
|
<p class="text-xl font-book pl-4 hover:underline cursor-pointer" @click.stop="$emit('click', library)">{{ library.name }}</p>
|
||||||
<div class="flex-grow" />
|
<div class="flex-grow" />
|
||||||
<ui-btn v-show="isHovering && !libraryScan && canScan" small color="bg" @click.stop="scan">Scan</ui-btn>
|
<ui-btn v-show="isHovering && !libraryScan && canScan" small color="bg" @click.stop="scan">Scan</ui-btn>
|
||||||
|
<ui-btn v-show="isHovering && !libraryScan && canScan" small color="bg" class="ml-2" @click.stop="forceScan">Force Re-Scan</ui-btn>
|
||||||
<span v-show="isHovering && !libraryScan && showEdit && canEdit" class="material-icons text-xl text-gray-300 hover:text-gray-50 ml-4 cursor-pointer" @click.stop="editClick">edit</span>
|
<span v-show="isHovering && !libraryScan && showEdit && canEdit" class="material-icons text-xl text-gray-300 hover:text-gray-50 ml-4 cursor-pointer" @click.stop="editClick">edit</span>
|
||||||
<span v-show="!libraryScan && isHovering && showEdit && canDelete && !isDeleting" class="material-icons text-xl text-gray-300 ml-3" :class="isMain ? 'text-opacity-5 cursor-not-allowed' : 'hover:text-gray-50 cursor-pointer'" @click.stop="deleteClick">delete</span>
|
<span v-show="!libraryScan && isHovering && showEdit && canDelete && !isDeleting" class="material-icons text-xl text-gray-300 ml-3" :class="isMain ? 'text-opacity-5 cursor-not-allowed' : 'hover:text-gray-50 cursor-pointer'" @click.stop="deleteClick">delete</span>
|
||||||
<div v-show="isDeleting" class="text-xl text-gray-300 ml-3 animate-spin">
|
<div v-show="isDeleting" class="text-xl text-gray-300 ml-3 animate-spin">
|
||||||
@ -67,6 +68,9 @@ export default {
|
|||||||
scan() {
|
scan() {
|
||||||
this.$root.socket.emit('scan', this.library.id)
|
this.$root.socket.emit('scan', this.library.id)
|
||||||
},
|
},
|
||||||
|
forceScan() {
|
||||||
|
this.$root.socket.emit('scan', this.library.id, {forceRescan: true})
|
||||||
|
},
|
||||||
deleteClick() {
|
deleteClick() {
|
||||||
if (this.isMain) return
|
if (this.isMain) return
|
||||||
if (confirm(`Are you sure you want to permanently delete library "${this.library.name}"?`)) {
|
if (confirm(`Are you sure you want to permanently delete library "${this.library.name}"?`)) {
|
||||||
|
@ -316,9 +316,9 @@ class Server {
|
|||||||
await this.scanner2.scanFilesChanged(fileUpdates)
|
await this.scanner2.scanFilesChanged(fileUpdates)
|
||||||
}
|
}
|
||||||
|
|
||||||
async scan(libraryId) {
|
async scan(libraryId, options = {}) {
|
||||||
Logger.info('[Server] Starting Scan')
|
Logger.info('[Server] Starting Scan')
|
||||||
await this.scanner2.scan(libraryId)
|
await this.scanner2.scan(libraryId, options)
|
||||||
// await this.scanner.scan(libraryId)
|
// await this.scanner.scan(libraryId)
|
||||||
Logger.info('[Server] Scan complete')
|
Logger.info('[Server] Scan complete')
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ class Scanner {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var checkRes = audiobook.checkScanData(dataFound, version)
|
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.audiobook = audiobook
|
||||||
checkRes.bookScanData = dataFound
|
checkRes.bookScanData = dataFound
|
||||||
audiobookDataToRescan.push(checkRes)
|
audiobookDataToRescan.push(checkRes)
|
||||||
@ -325,13 +325,13 @@ class Scanner {
|
|||||||
libraryScan.addLog(LogLevel.DEBUG, `Library "${libraryScan.libraryName}" Re-scanning "${audiobook.path}"`)
|
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
|
// 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
|
// TODO: Cleanup other file sync
|
||||||
var allOtherFiles = newOtherFileData.concat(audiobook._otherFiles)
|
var allOtherFiles = newOtherFileData.concat(audiobook._otherFiles)
|
||||||
await audiobook.syncOtherFiles(allOtherFiles, this.MetadataPath, libraryScan.preferOpfMetadata)
|
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)
|
await AudioFileScanner.scanAudioFiles(newAudioFileData, bookScanData, audiobook, libraryScan.preferAudioMetadata, libraryScan)
|
||||||
|
|
||||||
// Extract embedded cover art if cover is not already in directory
|
// Extract embedded cover art if cover is not already in directory
|
||||||
|
Loading…
Reference in New Issue
Block a user