mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-14 15:59:38 +00:00
Update FolderWatcher to singleton
This commit is contained in:
parent
a8ec07cfc9
commit
a5ebd89817
6 changed files with 17 additions and 19 deletions
|
|
@ -1,6 +1,7 @@
|
|||
const Logger = require('../Logger')
|
||||
const SocketAuthority = require('../SocketAuthority')
|
||||
const Database = require('../Database')
|
||||
const Watcher = require('../Watcher')
|
||||
|
||||
const fs = require('../libs/fsExtra')
|
||||
|
||||
|
|
@ -23,9 +24,7 @@ const AudioFile = require('../objects/files/AudioFile')
|
|||
const LibraryItem = require('../objects/LibraryItem')
|
||||
|
||||
class PodcastManager {
|
||||
constructor(watcher) {
|
||||
this.watcher = watcher
|
||||
|
||||
constructor() {
|
||||
this.downloadQueue = []
|
||||
this.currentDownload = null
|
||||
|
||||
|
|
@ -97,7 +96,7 @@ class PodcastManager {
|
|||
}
|
||||
|
||||
// Ignores all added files to this dir
|
||||
this.watcher.addIgnoreDir(this.currentDownload.libraryItem.path)
|
||||
Watcher.addIgnoreDir(this.currentDownload.libraryItem.path)
|
||||
|
||||
// Make sure podcast library item folder exists
|
||||
if (!(await fs.pathExists(this.currentDownload.libraryItem.path))) {
|
||||
|
|
@ -151,7 +150,7 @@ class PodcastManager {
|
|||
SocketAuthority.emitter('episode_download_finished', this.currentDownload.toJSONForClient())
|
||||
SocketAuthority.emitter('episode_download_queue_updated', this.getDownloadQueueDetails())
|
||||
|
||||
this.watcher.removeIgnoreDir(this.currentDownload.libraryItem.path)
|
||||
Watcher.removeIgnoreDir(this.currentDownload.libraryItem.path)
|
||||
this.currentDownload = null
|
||||
if (this.downloadQueue.length) {
|
||||
this.startPodcastEpisodeDownload(this.downloadQueue.shift())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue