From 87c097c8225fd00518aaf1be4710d2d939327e6d Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Mon, 23 Mar 2026 11:53:51 +0100 Subject: [PATCH] Fix auto-rename race in hybrid extraction missing MKV files During hybrid extraction, files can finish extracting between the auto-rename scan and MKV-move, causing them to be moved to the MKV library dir with their original scene names (e.g. awa-diethundermans03e21hd.mkv). Add a post-MKV-move auto-rename pass on the MKV library directory to catch these stragglers and rename them to the proper folder-based name. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/main/download-manager.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/download-manager.ts b/src/main/download-manager.ts index 128fdee..c4120b6 100644 --- a/src/main/download-manager.ts +++ b/src/main/download-manager.ts @@ -10735,6 +10735,22 @@ export class DownloadManager extends EventEmitter { pkg.postProcessLabel = "Verschiebe Videos..."; this.emitState(); await this.collectMkvFilesToLibrary(packageId, pkg, shouldAbort); + + // ── Post-MKV-move rename pass ── + // During hybrid extraction, files can finish extracting between the + // auto-rename scan and MKV-move, causing them to be moved with their + // original scene names (e.g. awa-diethundermans03e21hd.mkv). + // Run auto-rename on the MKV library dir to catch these stragglers. + if (this.settings.autoRename4sf4sj && this.settings.collectMkvToLibrary) { + const mkvDir = String(this.settings.mkvLibraryDir || "").trim(); + if (mkvDir && await this.existsAsync(mkvDir)) { + throwIfAborted(); + const postMkvRenamed = await this.autoRenameExtractedVideoFiles(mkvDir, pkg, shouldAbort); + if (postMkvRenamed > 0) { + logger.info(`Post-MKV-Move Auto-Rename: pkg=${pkg.name}, renamed=${postMkvRenamed} in ${mkvDir}`); + } + } + } } throwIfAborted();