fix: update extractChaptersXml to save XML file next to original source and reflect changes in documentation
Build / Lint & Test (push) Successful in 17s

This commit is contained in:
PickleRick committed 2026-09-19 20:01:20 +02:00
1 parent 95df925de7
commit 9b0ed4677d
3 files changed
+8 -4

No files matched your search

@@ -8,7 +8,7 @@ const fs = require('fs');
const details = () => ({
name: 'Extract Chapters to XML',
description:
'Extracts MKV chapter markers to an XML file in workDir using mkvextract. '
'Extracts MKV chapter markers to an XML file next to the original source using mkvextract. '
+ 'Stores the output path in args.variables.chaptersXmlPath. '
+ 'Safe to run even if the source has no chapters.',
style: { borderColor: '#9C27B0' },
@@ -28,8 +28,11 @@ const plugin = async (args) => {
const { jobLog, inputFileObj, variables, workDir, updateWorker } = args;
const inputFile = inputFileObj._id;
const baseName = path.basename(inputFile, path.extname(inputFile));
const xmlPath = path.join(workDir, `${baseName}_chapters.xml`);
// Keep sidecar files in the library when a prior plugin copied the media to workDir.
const originalFile = variables.originalLibraryFile || inputFile;
const targetDir = variables.originalLibraryDir || path.dirname(originalFile);
const baseName = path.basename(originalFile, path.extname(originalFile));
const xmlPath = path.join(targetDir, `${baseName}_chapters.xml`);
jobLog(`[extractChaptersXml] Source: ${inputFile}\n`);
jobLog(`[extractChaptersXml] Output: ${xmlPath}\n`);