Add:New scanner and scanner server settings

This commit is contained in:
advplyr 2021-11-25 18:39:02 -06:00
parent bf11d266dc
commit a5fc382cad
17 changed files with 681 additions and 176 deletions

View file

@ -104,11 +104,23 @@ export default {
if (payload.serverSettings) {
this.$store.commit('setServerSettings', payload.serverSettings)
}
// Start scans currently running
if (payload.librariesScanning) {
payload.librariesScanning.forEach((libraryScan) => {
this.scanStart(libraryScan)
})
}
// Remove any current scans that are no longer running
var currentScans = [...this.$store.state.scanners.libraryScans]
currentScans.forEach((ls) => {
if (!payload.librariesScanning || !payload.librariesScanning.find((_ls) => _ls.id === ls.id)) {
this.$toast.dismiss(ls.toastId)
this.$store.commit('scanners/remove', ls)
}
})
if (payload.backups && payload.backups.length) {
this.$store.commit('setBackups', payload.backups)
}
@ -152,6 +164,16 @@ export default {
}
this.$store.commit('audiobooks/remove', audiobook)
},
audiobooksAdded(audiobooks) {
audiobooks.forEach((ab) => {
this.$store.commit('audiobooks/addUpdate', ab)
})
},
audiobooksUpdated(audiobooks) {
audiobooks.forEach((ab) => {
this.$store.commit('audiobooks/addUpdate', ab)
})
},
libraryAdded(library) {
this.$store.commit('libraries/addUpdate', library)
},
@ -162,6 +184,8 @@ export default {
this.$store.commit('libraries/remove', library)
},
scanComplete(data) {
console.log('Scan complete received', data)
var message = `Scan "${data.name}" complete!`
if (data.results) {
var scanResultMsgs = []
@ -337,6 +361,8 @@ export default {
this.socket.on('audiobook_updated', this.audiobookUpdated)
this.socket.on('audiobook_added', this.audiobookAdded)
this.socket.on('audiobook_removed', this.audiobookRemoved)
this.socket.on('audiobooks_updated', this.audiobooksUpdated)
this.socket.on('audiobooks_added', this.audiobooksAdded)
// Library Listeners
this.socket.on('library_updated', this.libraryUpdated)

View file

@ -21,6 +21,20 @@
</ui-tooltip>
</div>
<div class="flex items-center py-2">
<ui-toggle-switch v-model="newServerSettings.scannerPreferAudioMetadata" :disabled="updatingServerSettings" @input="updateScannerPreferAudioMeta" />
<ui-tooltip :text="scannerPreferAudioMetaTooltip">
<p class="pl-4 text-lg">Scanner prefer audio metadata <span class="material-icons icon-text">info_outlined</span></p>
</ui-tooltip>
</div>
<div class="flex items-center py-2">
<ui-toggle-switch v-model="newServerSettings.scannerPreferOpfMetadata" :disabled="updatingServerSettings" @input="updateScannerPreferOpfMeta" />
<ui-tooltip :text="scannerPreferOpfMetaTooltip">
<p class="pl-4 text-lg">Scanner prefer OPF metadata <span class="material-icons icon-text">info_outlined</span></p>
</ui-tooltip>
</div>
<div class="flex items-center py-2">
<ui-toggle-switch v-model="storeCoversInAudiobookDir" :disabled="updatingServerSettings" @input="updateCoverStorageDestination" />
<ui-tooltip :text="coverDestinationTooltip">
@ -83,6 +97,12 @@ export default {
}
},
computed: {
scannerPreferAudioMetaTooltip() {
return 'Audio file ID3 meta tags will be used for book details over folder & filenames'
},
scannerPreferOpfMetaTooltip() {
return 'OPF file metadata will be used for book details over folder & filenames'
},
saveMetadataTooltip() {
return 'This will write a "metadata.nfo" file in all of your audiobook directories.'
},
@ -127,6 +147,16 @@ export default {
scannerParseSubtitle: !!val
})
},
updateScannerPreferAudioMeta(val) {
this.updateServerSettings({
scannerPreferAudioMetadata: !!val
})
},
updateScannerPreferOpfMeta(val) {
this.updateServerSettings({
scannerPreferOpfMetadata: !!val
})
},
updateServerSettings(payload) {
this.updatingServerSettings = true
this.$store
@ -144,7 +174,6 @@ export default {
this.newServerSettings = this.serverSettings ? { ...this.serverSettings } : {}
this.storeCoversInAudiobookDir = this.newServerSettings.coverDestination === this.$constants.CoverDestination.AUDIOBOOK
this.storeCoversInAudiobookDir = this.newServerSettings.coverDestination === this.$constants.CoverDestination.AUDIOBOOK
},
resetAudiobooks() {
if (confirm('WARNING! This action will remove all audiobooks from the database including any updates or matches you have made. This does not do anything to your actual files. Shall we continue?')) {