mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-24 09:49:24 +02:00
Update FolderWatcher to singleton
This commit is contained in:
parent
a8ec07cfc9
commit
a5ebd89817
6 changed files with 17 additions and 19 deletions
|
@ -5,6 +5,7 @@ const fs = require('../libs/fsExtra')
|
|||
const Logger = require('../Logger')
|
||||
const SocketAuthority = require('../SocketAuthority')
|
||||
const Database = require('../Database')
|
||||
const Watcher = require('../Watcher')
|
||||
|
||||
const libraryItemFilters = require('../utils/queries/libraryItemFilters')
|
||||
const patternValidation = require('../libs/nodeCron/pattern-validation')
|
||||
|
@ -557,10 +558,10 @@ class MiscController {
|
|||
|
||||
switch (type) {
|
||||
case 'add':
|
||||
this.watcher.onFileAdded(libraryId, path)
|
||||
Watcher.onFileAdded(libraryId, path)
|
||||
break
|
||||
case 'unlink':
|
||||
this.watcher.onFileRemoved(libraryId, path)
|
||||
Watcher.onFileRemoved(libraryId, path)
|
||||
break
|
||||
case 'rename':
|
||||
const oldPath = req.body.oldPath
|
||||
|
@ -568,7 +569,7 @@ class MiscController {
|
|||
Logger.error(`[MiscController] Invalid request body for updateWatchedPath. oldPath is required for rename.`)
|
||||
return res.sendStatus(400)
|
||||
}
|
||||
this.watcher.onFileRename(libraryId, oldPath, path)
|
||||
Watcher.onFileRename(libraryId, oldPath, path)
|
||||
break
|
||||
default:
|
||||
Logger.error(`[MiscController] Invalid type for updateWatchedPath. type: "${type}"`)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue