Skip to content

Commit

Permalink
Don't import files that are already being imported
Browse files Browse the repository at this point in the history
  • Loading branch information
robinp7720 committed Nov 7, 2023
1 parent 1963536 commit ce9d1e3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib/seedbox/SeedboxController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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)}`);
Expand All @@ -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 {
Expand Down

0 comments on commit ce9d1e3

Please sign in to comment.