mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-31 15:19:42 +02:00
Change Library object use mediaCategory, allow adding new manual folder path, validate folder paths, fix Watcher re-init after folder path updates
This commit is contained in:
parent
7348432594
commit
deea6702f0
10 changed files with 98 additions and 47 deletions
|
@ -85,12 +85,15 @@ class FolderWatcher extends EventEmitter {
|
|||
if (libwatcher) {
|
||||
libwatcher.name = library.name
|
||||
|
||||
// If any folder paths were added or removed then re-init watcher
|
||||
var pathsToAdd = library.folderPaths.filter(path => !libwatcher.paths.includes(path))
|
||||
if (pathsToAdd.length) {
|
||||
Logger.info(`[Watcher] Adding paths to library watcher "${library.name}"`)
|
||||
libwatcher.paths = library.folderPaths
|
||||
libwatcher.folders = library.folders
|
||||
libwatcher.watcher.watchPaths(pathsToAdd)
|
||||
var pathsRemoved = libwatcher.paths.filter(path => !library.folderPaths.includes(path))
|
||||
if (pathsToAdd.length || pathsRemoved.length) {
|
||||
Logger.info(`[Watcher] Re-Initializing watcher for "${library.name}".`)
|
||||
|
||||
libwatcher.watcher.close()
|
||||
this.libraryWatchers = this.libraryWatchers.filter(lw => lw.id !== libwatcher.id)
|
||||
this.buildLibraryWatcher(library)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue