From ce9d1e355a1553bcd04d535d078acc1bb21a408f Mon Sep 17 00:00:00 2001 From: Zeyphros Date: Tue, 7 Nov 2023 12:40:36 +0100 Subject: [PATCH] Don't import files that are already being imported --- src/lib/seedbox/SeedboxController.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/seedbox/SeedboxController.js b/src/lib/seedbox/SeedboxController.js index 72f07b3..50fe302 100644 --- a/src/lib/seedbox/SeedboxController.js +++ b/src/lib/seedbox/SeedboxController.js @@ -90,6 +90,15 @@ export default class SeedboxController { await this.importFile(seedbox, origin, destination); await this.oblecto.seriesCollector.collectFile(destination); } + alreadyImportingFile(filePath) { + for (let i of this.importQueue.queue._tasks) { + if (i.attr.origin === filePath) { + return true; + } + } + + return false; + } async shouldImportMovie(filePath) { const method = 'file'; @@ -135,6 +144,7 @@ export default class SeedboxController { // We don't want to import these if (file.toLowerCase().includes('sample')) continue; + if (this.alreadyImportingFile(file)) continue; if (!await this.shouldImportMovie(file)) continue; logger.log('INFO', `Found new movie on ${seedbox.name}: ${basename(file)}`); @@ -161,6 +171,8 @@ export default class SeedboxController { // We don't want to import these if (file.toLowerCase().includes('sample')) continue; + if (this.alreadyImportingFile(file)) continue; + let identification; try {