mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-06 00:16:02 +01:00
Add:Disable watcher library specific #378
This commit is contained in:
parent
aa675422a9
commit
d368988899
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="w-full h-full px-4 py-2 mb-12">
|
<div class="w-full h-full px-4 py-2 mb-4">
|
||||||
<div class="flex items-center py-1 mb-2">
|
<div v-show="showDirectoryPicker" class="flex items-center py-1 mb-2">
|
||||||
<span v-show="showDirectoryPicker" class="material-icons text-3xl cursor-pointer hover:text-gray-300" @click="backArrowPress">arrow_back</span>
|
<span class="material-icons text-3xl cursor-pointer hover:text-gray-300" @click="backArrowPress">arrow_back</span>
|
||||||
<p class="px-4 text-xl">{{ title }}</p>
|
<p class="px-4 text-xl">{{ title }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -33,7 +33,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<modals-libraries-folder-chooser v-else :paths="folderPaths" @select="selectFolder" />
|
<modals-libraries-folder-chooser v-else :paths="folderPaths" @select="selectFolder" />
|
||||||
|
|
||||||
|
<div v-if="!showDirectoryPicker">
|
||||||
|
<div class="flex items-center pt-2">
|
||||||
|
<ui-toggle-switch v-if="!globalWatcherDisabled" v-model="disableWatcher" />
|
||||||
|
<ui-toggle-switch v-else disabled :value="false" />
|
||||||
|
<p class="pl-4 text-lg">Disable folder watcher for library</p>
|
||||||
|
</div>
|
||||||
|
<p v-if="globalWatcherDisabled" class="text-xs text-warning">*Watcher is disabled globally in server settings</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -51,7 +61,8 @@ export default {
|
|||||||
name: '',
|
name: '',
|
||||||
provider: '',
|
provider: '',
|
||||||
folders: [],
|
folders: [],
|
||||||
showDirectoryPicker: false
|
showDirectoryPicker: false,
|
||||||
|
disableWatcher: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -69,10 +80,13 @@ export default {
|
|||||||
var newfolderpaths = this.folderPaths.join(',')
|
var newfolderpaths = this.folderPaths.join(',')
|
||||||
var origfolderpaths = this.library.folders.map((f) => f.fullPath).join(',')
|
var origfolderpaths = this.library.folders.map((f) => f.fullPath).join(',')
|
||||||
|
|
||||||
return newfolderpaths === origfolderpaths && this.name === this.library.name && this.provider === this.library.provider
|
return newfolderpaths === origfolderpaths && this.name === this.library.name && this.provider === this.library.provider && this.disableWatcher === this.library.disableWatcher
|
||||||
},
|
},
|
||||||
providers() {
|
providers() {
|
||||||
return this.$store.state.scanners.providers
|
return this.$store.state.scanners.providers
|
||||||
|
},
|
||||||
|
globalWatcherDisabled() {
|
||||||
|
return this.$store.getters['getServerSetting']('scannerDisableWatcher')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -88,6 +102,7 @@ export default {
|
|||||||
this.name = this.library ? this.library.name : ''
|
this.name = this.library ? this.library.name : ''
|
||||||
this.provider = this.library ? this.library.provider : ''
|
this.provider = this.library ? this.library.provider : ''
|
||||||
this.folders = this.library ? this.library.folders.map((p) => ({ ...p })) : []
|
this.folders = this.library ? this.library.folders.map((p) => ({ ...p })) : []
|
||||||
|
this.disableWatcher = this.library ? !!this.library.disableWatcher : false
|
||||||
this.showDirectoryPicker = false
|
this.showDirectoryPicker = false
|
||||||
},
|
},
|
||||||
selectFolder(fullPath) {
|
selectFolder(fullPath) {
|
||||||
@ -113,7 +128,8 @@ export default {
|
|||||||
var newLibraryPayload = {
|
var newLibraryPayload = {
|
||||||
name: this.name,
|
name: this.name,
|
||||||
provider: this.provider,
|
provider: this.provider,
|
||||||
folders: this.folders
|
folders: this.folders,
|
||||||
|
disableWatcher: this.disableWatcher
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('update:processing', true)
|
this.$emit('update:processing', true)
|
||||||
@ -146,7 +162,8 @@ export default {
|
|||||||
var newLibraryPayload = {
|
var newLibraryPayload = {
|
||||||
name: this.name,
|
name: this.name,
|
||||||
provider: this.provider,
|
provider: this.provider,
|
||||||
folders: this.folders
|
folders: this.folders,
|
||||||
|
disableWatcher: this.disableWatcher
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('update:processing', true)
|
this.$emit('update:processing', true)
|
||||||
|
@ -68,17 +68,19 @@ class FolderWatcher extends EventEmitter {
|
|||||||
|
|
||||||
initWatcher(libraries) {
|
initWatcher(libraries) {
|
||||||
libraries.forEach((lib) => {
|
libraries.forEach((lib) => {
|
||||||
this.buildLibraryWatcher(lib)
|
if (!lib.disableWatcher) {
|
||||||
|
this.buildLibraryWatcher(lib)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
addLibrary(library) {
|
addLibrary(library) {
|
||||||
if (this.disabled) return
|
if (this.disabled || library.disableWatcher) return
|
||||||
this.buildLibraryWatcher(library)
|
this.buildLibraryWatcher(library)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLibrary(library) {
|
updateLibrary(library) {
|
||||||
if (this.disabled) return
|
if (this.disabled || library.disableWatcher) return
|
||||||
var libwatcher = this.libraryWatchers.find(lib => lib.id === library.id)
|
var libwatcher = this.libraryWatchers.find(lib => lib.id === library.id)
|
||||||
if (libwatcher) {
|
if (libwatcher) {
|
||||||
libwatcher.name = library.name
|
libwatcher.name = library.name
|
||||||
|
@ -9,6 +9,7 @@ class Library {
|
|||||||
this.displayOrder = 1
|
this.displayOrder = 1
|
||||||
this.icon = 'database'
|
this.icon = 'database'
|
||||||
this.provider = 'google'
|
this.provider = 'google'
|
||||||
|
this.disableWatcher = false
|
||||||
|
|
||||||
this.lastScan = 0
|
this.lastScan = 0
|
||||||
|
|
||||||
@ -31,6 +32,7 @@ class Library {
|
|||||||
this.displayOrder = library.displayOrder || 1
|
this.displayOrder = library.displayOrder || 1
|
||||||
this.icon = library.icon || 'database'
|
this.icon = library.icon || 'database'
|
||||||
this.provider = library.provider || 'google'
|
this.provider = library.provider || 'google'
|
||||||
|
this.disableWatcher = !!library.disableWatcher
|
||||||
|
|
||||||
this.createdAt = library.createdAt
|
this.createdAt = library.createdAt
|
||||||
this.lastUpdate = library.lastUpdate
|
this.lastUpdate = library.lastUpdate
|
||||||
@ -44,6 +46,7 @@ class Library {
|
|||||||
displayOrder: this.displayOrder,
|
displayOrder: this.displayOrder,
|
||||||
icon: this.icon,
|
icon: this.icon,
|
||||||
provider: this.provider,
|
provider: this.provider,
|
||||||
|
disableWatcher: this.disableWatcher,
|
||||||
createdAt: this.createdAt,
|
createdAt: this.createdAt,
|
||||||
lastUpdate: this.lastUpdate
|
lastUpdate: this.lastUpdate
|
||||||
}
|
}
|
||||||
@ -68,6 +71,7 @@ class Library {
|
|||||||
}
|
}
|
||||||
this.displayOrder = data.displayOrder || 1
|
this.displayOrder = data.displayOrder || 1
|
||||||
this.icon = data.icon || 'database'
|
this.icon = data.icon || 'database'
|
||||||
|
this.disableWatcher = !!data.disableWatcher
|
||||||
this.createdAt = Date.now()
|
this.createdAt = Date.now()
|
||||||
this.lastUpdate = Date.now()
|
this.lastUpdate = Date.now()
|
||||||
}
|
}
|
||||||
@ -82,6 +86,10 @@ class Library {
|
|||||||
this.provider = payload.provider
|
this.provider = payload.provider
|
||||||
hasUpdates = true
|
hasUpdates = true
|
||||||
}
|
}
|
||||||
|
if (payload.disableWatcher !== this.disableWatcher) {
|
||||||
|
this.disableWatcher = !!payload.disableWatcher
|
||||||
|
hasUpdates = true
|
||||||
|
}
|
||||||
if (!isNaN(payload.displayOrder) && payload.displayOrder !== this.displayOrder) {
|
if (!isNaN(payload.displayOrder) && payload.displayOrder !== this.displayOrder) {
|
||||||
this.displayOrder = Number(payload.displayOrder)
|
this.displayOrder = Number(payload.displayOrder)
|
||||||
hasUpdates = true
|
hasUpdates = true
|
||||||
|
Loading…
Reference in New Issue
Block a user