mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-15 02:05:54 -07:00
Merge pull request #494 from HaveAGitGat/changes
shouldProcess if overallOuputArguments
This commit is contained in:
commit
7d09d2085e
2 changed files with 25 additions and 10 deletions
|
|
@ -96,7 +96,7 @@ var getOuputStreamTypeIndex = function (streams, stream) {
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var lib, cliArgs, inputArgs, _a, shouldProcess, streams, _loop_1, i, idx, outputFilePath, cli, res;
|
var lib, cliArgs, _a, shouldProcess, streams, inputArgs, _loop_1, i, idx, outputFilePath, cli, res;
|
||||||
return __generator(this, function (_b) {
|
return __generator(this, function (_b) {
|
||||||
switch (_b.label) {
|
switch (_b.label) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -107,8 +107,11 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
cliArgs.push('-y');
|
cliArgs.push('-y');
|
||||||
cliArgs.push('-i');
|
cliArgs.push('-i');
|
||||||
cliArgs.push(args.inputFileObj._id);
|
cliArgs.push(args.inputFileObj._id);
|
||||||
inputArgs = __spreadArray([], args.variables.ffmpegCommand.overallInputArguments, true);
|
|
||||||
_a = args.variables.ffmpegCommand, shouldProcess = _a.shouldProcess, streams = _a.streams;
|
_a = args.variables.ffmpegCommand, shouldProcess = _a.shouldProcess, streams = _a.streams;
|
||||||
|
if (args.variables.ffmpegCommand.overallInputArguments.length > 0) {
|
||||||
|
shouldProcess = true;
|
||||||
|
}
|
||||||
|
inputArgs = __spreadArray([], args.variables.ffmpegCommand.overallInputArguments, true);
|
||||||
streams = streams.filter(function (stream) {
|
streams = streams.filter(function (stream) {
|
||||||
if (stream.removed) {
|
if (stream.removed) {
|
||||||
shouldProcess = true;
|
shouldProcess = true;
|
||||||
|
|
@ -140,6 +143,12 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
for (i = 0; i < streams.length; i += 1) {
|
for (i = 0; i < streams.length; i += 1) {
|
||||||
_loop_1(i);
|
_loop_1(i);
|
||||||
}
|
}
|
||||||
|
idx = cliArgs.indexOf('-i');
|
||||||
|
cliArgs.splice.apply(cliArgs, __spreadArray([idx, 0], inputArgs, false));
|
||||||
|
if (args.variables.ffmpegCommand.overallOuputArguments.length > 0) {
|
||||||
|
cliArgs.push.apply(cliArgs, args.variables.ffmpegCommand.overallOuputArguments);
|
||||||
|
shouldProcess = true;
|
||||||
|
}
|
||||||
if (!shouldProcess) {
|
if (!shouldProcess) {
|
||||||
args.jobLog('No need to process file, already as required');
|
args.jobLog('No need to process file, already as required');
|
||||||
return [2 /*return*/, {
|
return [2 /*return*/, {
|
||||||
|
|
@ -148,9 +157,6 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
variables: args.variables,
|
variables: args.variables,
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
idx = cliArgs.indexOf('-i');
|
|
||||||
cliArgs.splice.apply(cliArgs, __spreadArray([idx, 0], inputArgs, false));
|
|
||||||
cliArgs.push.apply(cliArgs, args.variables.ffmpegCommand.overallOuputArguments);
|
|
||||||
outputFilePath = "".concat((0, fileUtils_1.getPluginWorkDir)(args), "/").concat((0, fileUtils_1.getFileName)(args.inputFileObj._id))
|
outputFilePath = "".concat((0, fileUtils_1.getPluginWorkDir)(args), "/").concat((0, fileUtils_1.getFileName)(args.inputFileObj._id))
|
||||||
+ ".".concat(args.variables.ffmpegCommand.container);
|
+ ".".concat(args.variables.ffmpegCommand.container);
|
||||||
cliArgs.push(outputFilePath);
|
cliArgs.push(outputFilePath);
|
||||||
|
|
|
||||||
|
|
@ -74,10 +74,15 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
||||||
cliArgs.push('-i');
|
cliArgs.push('-i');
|
||||||
cliArgs.push(args.inputFileObj._id);
|
cliArgs.push(args.inputFileObj._id);
|
||||||
|
|
||||||
|
let { shouldProcess, streams } = args.variables.ffmpegCommand;
|
||||||
|
|
||||||
|
if (args.variables.ffmpegCommand.overallInputArguments.length > 0) {
|
||||||
|
shouldProcess = true;
|
||||||
|
}
|
||||||
|
|
||||||
const inputArgs: string[] = [
|
const inputArgs: string[] = [
|
||||||
...args.variables.ffmpegCommand.overallInputArguments,
|
...args.variables.ffmpegCommand.overallInputArguments,
|
||||||
];
|
];
|
||||||
let { shouldProcess, streams } = args.variables.ffmpegCommand;
|
|
||||||
|
|
||||||
streams = streams.filter((stream) => {
|
streams = streams.filter((stream) => {
|
||||||
if (stream.removed) {
|
if (stream.removed) {
|
||||||
|
|
@ -114,6 +119,14 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
||||||
inputArgs.push(...stream.inputArgs);
|
inputArgs.push(...stream.inputArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const idx = cliArgs.indexOf('-i');
|
||||||
|
cliArgs.splice(idx, 0, ...inputArgs);
|
||||||
|
|
||||||
|
if (args.variables.ffmpegCommand.overallOuputArguments.length > 0) {
|
||||||
|
cliArgs.push(...args.variables.ffmpegCommand.overallOuputArguments);
|
||||||
|
shouldProcess = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!shouldProcess) {
|
if (!shouldProcess) {
|
||||||
args.jobLog('No need to process file, already as required');
|
args.jobLog('No need to process file, already as required');
|
||||||
return {
|
return {
|
||||||
|
|
@ -123,10 +136,6 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const idx = cliArgs.indexOf('-i');
|
|
||||||
cliArgs.splice(idx, 0, ...inputArgs);
|
|
||||||
cliArgs.push(...args.variables.ffmpegCommand.overallOuputArguments);
|
|
||||||
|
|
||||||
const outputFilePath = `${getPluginWorkDir(args)}/${getFileName(args.inputFileObj._id)}`
|
const outputFilePath = `${getPluginWorkDir(args)}/${getFileName(args.inputFileObj._id)}`
|
||||||
+ `.${args.variables.ffmpegCommand.container}`;
|
+ `.${args.variables.ffmpegCommand.container}`;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue