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`);
+1 -1
View File
@@ -149,7 +149,7 @@ Manually forces `isAnimation=true` and `x265Tune=animation` when a file was not
**Category**: `utility` · **Step**: before transcode
Runs `mkvextract` to dump chapter markers to an XML file in `workDir`. Stores the path in `variables.chaptersXmlPath` for downstream use. Safe to run even when the source has no chapters (mkvextract exit 1 is treated as "no chapters").
Runs `mkvextract` to dump chapter markers to an XML file **next to the original source file**. Stores the path in `variables.chaptersXmlPath` for downstream use. Safe to run even when the source has no chapters (mkvextract exit 1 is treated as "no chapters").
**No inputs required.**
+1
View File
@@ -198,6 +198,7 @@ Per ogni file sorgente `/media/toshiba/Radarr/Film (2023)/Film (2023).mkv`:
├── Film (2023).eng.srt ← estratto da extractSubtitlesAndOcr
├── Film (2023).ita.forced.srt ← (se traccia forced presente)
├── Film (2023).eng.sdh.srt ← (se traccia SDH presente)
├── Film (2023)_chapters.xml ← estratto da extractChaptersXml
└── Film (2023).ita.dts ← backup (solo se codec DTS)
o Film (2023).ita.thd ← backup (solo se codec TrueHD)
```