fix: pass full args object to CLI constructors in all plugins to prevent cliUtils TypeError on variables/liveSizeCompare
Build / Lint & Test (push) Successful in 15s
Build / Lint & Test (push) Successful in 15s
This commit is contained in:
1 parent
5447c1cbc7
commit
27fee1ee95
4 files changed
+22
-6
No files matched your search
@@ -78,6 +78,7 @@ const plugin = async (args) => {
|
||||
jobLog,
|
||||
inputFileObj,
|
||||
updateWorker,
|
||||
args,
|
||||
});
|
||||
|
||||
const { cliExitCode } = await cli.runCli();
|
||||
|
||||
@@ -79,10 +79,21 @@ const buildSuffix = (lang, stream) => {
|
||||
return parts.join('.');
|
||||
};
|
||||
|
||||
const runFFmpeg = async (spawnArgs, workDir, ffmpegPath, jobLog, inputFileObj, updateWorker) => {
|
||||
/**
|
||||
* Run FFmpeg via Tdarr's CLI helper.
|
||||
* Passes the full args object so cliUtils can access any field it needs
|
||||
* (inputFileObj, updateWorker, variables, etc.) without us having to predict them.
|
||||
*/
|
||||
const runFFmpeg = async (spawnArgs, args) => {
|
||||
const { CLI } = require('../../../../FlowHelpers/1.0.0/cliUtils');
|
||||
const cli = new CLI({
|
||||
cli: ffmpegPath, spawnArgs, WorkDir: workDir, jobLog, inputFileObj, updateWorker,
|
||||
cli: args.ffmpegPath,
|
||||
spawnArgs,
|
||||
WorkDir: args.workDir,
|
||||
jobLog: args.jobLog,
|
||||
inputFileObj: args.inputFileObj,
|
||||
updateWorker: args.updateWorker,
|
||||
args,
|
||||
});
|
||||
return cli.runCli();
|
||||
};
|
||||
@@ -90,7 +101,7 @@ const runFFmpeg = async (spawnArgs, workDir, ffmpegPath, jobLog, inputFileObj, u
|
||||
// ─── Plugin ───────────────────────────────────────────────────────────────────
|
||||
|
||||
const plugin = async (args) => {
|
||||
const { jobLog, inputFileObj, variables, workDir, updateWorker } = args;
|
||||
const { jobLog, inputFileObj, variables, workDir } = args;
|
||||
|
||||
const inputFile = inputFileObj._id;
|
||||
const sourceDir = path.dirname(inputFile);
|
||||
@@ -129,7 +140,7 @@ const plugin = async (args) => {
|
||||
if (TEXT_CODECS.has(codec)) {
|
||||
const { cliExitCode } = await runFFmpeg(
|
||||
['-y', '-i', inputFile, '-map', `0:${stream.index}`, '-c:s', 'srt', outSrt],
|
||||
workDir, args.ffmpegPath, jobLog, inputFileObj, updateWorker,
|
||||
args,
|
||||
);
|
||||
if (cliExitCode !== 0) {
|
||||
jobLog(`[extractSubtitlesAndOcr] WARNING: FFmpeg failed for stream #${stream.index} (exit ${cliExitCode}).\n`);
|
||||
@@ -146,7 +157,7 @@ const plugin = async (args) => {
|
||||
// Step 1: Extract to .sup
|
||||
const { cliExitCode: extractExit } = await runFFmpeg(
|
||||
['-y', '-i', inputFile, '-map', `0:${stream.index}`, '-c:s', 'copy', tmpSup],
|
||||
workDir, args.ffmpegPath, jobLog, inputFileObj, updateWorker,
|
||||
args,
|
||||
);
|
||||
|
||||
if (extractExit !== 0) {
|
||||
@@ -167,7 +178,8 @@ const plugin = async (args) => {
|
||||
WorkDir: workDir,
|
||||
jobLog,
|
||||
inputFileObj,
|
||||
updateWorker,
|
||||
updateWorker: args.updateWorker,
|
||||
args,
|
||||
});
|
||||
const { cliExitCode: seExit } = await seCli.runCli();
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ const plugin = async (args) => {
|
||||
jobLog,
|
||||
inputFileObj,
|
||||
updateWorker,
|
||||
args,
|
||||
});
|
||||
|
||||
const { cliExitCode } = await cli.runCli();
|
||||
|
||||
@@ -179,6 +179,7 @@ const plugin = async (args) => {
|
||||
jobLog,
|
||||
inputFileObj,
|
||||
updateWorker,
|
||||
args,
|
||||
});
|
||||
|
||||
const { cliExitCode: pass1Exit } = await pass1Cli.runCli();
|
||||
@@ -211,6 +212,7 @@ const plugin = async (args) => {
|
||||
jobLog,
|
||||
inputFileObj,
|
||||
updateWorker,
|
||||
args,
|
||||
});
|
||||
|
||||
const { cliExitCode: pass2Exit } = await pass2Cli.runCli();
|
||||
|
||||
Reference in new issue
Block a user