fix: optimize subtitle extraction with mkvextract batch mode, fix copyToWorkDir skip logic, target original library dir
Build / Lint & Test (push) Successful in 13s

This commit is contained in:
PickleRick committed 2026-09-19 15:17:38 +02:00
1 parent 27fee1ee95
commit 1cdd771045
3 files changed
+133 -94

No files matched your search

@@ -68,19 +68,17 @@ const plugin = async (args) => {
jobLog(`[copyToWorkDir] Source : ${inputFile}\n`);
jobLog(`[copyToWorkDir] WorkDir: ${workDir}\n`);
// ── Optional: skip if source is already local ─────────────────────────────
// ── Skip only if file is already located inside workDir ──────────────────
const skipIfLocal = (args.inputs.skipIfLocal || 'true') === 'true';
if (skipIfLocal) {
const srcDrive = inputFile.split(/[/\\]/)[0].toUpperCase(); // e.g. "T:"
const workDrive = workDir.split(/[/\\]/)[0].toUpperCase(); // e.g. "T:"
const alreadyLocal = (
inputFile.startsWith(workDir)
|| (srcDrive && workDrive && srcDrive === workDrive)
);
if (alreadyLocal) {
jobLog(`[copyToWorkDir] Source is already local (same drive: ${srcDrive}) — skipping copy.\n`);
return { outputNumber: 1, outputFileObj: inputFileObj, variables };
}
if (skipIfLocal && inputFile.startsWith(workDir)) {
jobLog('[copyToWorkDir] Source file is already inside workDir — skipping copy.\n');
return { outputNumber: 1, outputFileObj: inputFileObj, variables };
}
// ── Preserve original library paths for downstream plugins ──────────────
if (!variables.originalLibraryFile) {
variables.originalLibraryFile = inputFile;
variables.originalLibraryDir = path.dirname(inputFile);
}
// ── Copy using streams (no RAM spike for large files) ────────────────────