Compare commits

...

2 Commits

Author SHA1 Message Date
Sucukdeluxe
74d9047f4c Release v1.6.87 2026-03-06 19:33:59 +01:00
Sucukdeluxe
06e649ba5b fix: skip sample MKVs during library collection
MKV library collection now filters out sample files before moving.
Files in "sample"/"samples" directories and files with "sample" in
their name are excluded. This prevents duplicate "(2)" entries in
the library folder caused by samples having the same base name as
the real episodes (just different casing from the archive).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 19:33:15 +01:00
2 changed files with 25 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "real-debrid-downloader",
"version": "1.6.86",
"version": "1.6.87",
"description": "Desktop downloader",
"main": "build/main/main/main.js",
"author": "Sucukdeluxe",

View File

@ -2509,12 +2509,34 @@ export class DownloadManager extends EventEmitter {
return;
}
const mkvFiles = await this.collectFilesByExtensions(sourceDir, new Set([".mkv"]));
if (mkvFiles.length === 0) {
const allMkvFiles = await this.collectFilesByExtensions(sourceDir, new Set([".mkv"]));
if (allMkvFiles.length === 0) {
logger.info(`MKV-Sammelordner: pkg=${pkg.name}, keine MKV gefunden`);
return;
}
// Filter: Sample-Dateien ausschließen (Sample-Ordner + "sample" im Dateinamen)
const sampleDirNames = new Set(["sample", "samples"]);
const sampleTokenRe = /(^|[._\-\s])sample([._\-\s]|$)/i;
const mkvFiles: string[] = [];
let sampleSkipped = 0;
for (const filePath of allMkvFiles) {
const parentDir = path.basename(path.dirname(filePath)).toLowerCase();
const stem = path.parse(path.basename(filePath)).name;
if (sampleDirNames.has(parentDir) || sampleTokenRe.test(stem)) {
sampleSkipped += 1;
continue;
}
mkvFiles.push(filePath);
}
if (sampleSkipped > 0) {
logger.info(`MKV-Sammelordner: pkg=${pkg.name}, ${sampleSkipped} Sample-MKV(s) übersprungen`);
}
if (mkvFiles.length === 0) {
logger.info(`MKV-Sammelordner: pkg=${pkg.name}, keine MKV nach Sample-Filter`);
return;
}
const reservedTargets = new Set<string>();
let moved = 0;
let skipped = 0;