mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-14 01:36:08 -07:00
Prune blank args
This commit is contained in:
parent
9e0812b143
commit
d9d03b9517
4 changed files with 14 additions and 9 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, _a, shouldProcess, streams, inputArgs, _loop_1, i, idx, outputFilePath, cli, res;
|
var lib, cliArgs, _a, shouldProcess, streams, inputArgs, _loop_1, i, idx, outputFilePath, spawnArgs, cli, res;
|
||||||
return __generator(this, function (_b) {
|
return __generator(this, function (_b) {
|
||||||
switch (_b.label) {
|
switch (_b.label) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -160,18 +160,19 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
||||||
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);
|
||||||
|
spawnArgs = cliArgs.map(function (row) { return row.trim(); }).filter(function (row) { return row !== ''; });
|
||||||
args.jobLog('Processing file');
|
args.jobLog('Processing file');
|
||||||
args.jobLog(JSON.stringify({
|
args.jobLog(JSON.stringify({
|
||||||
cliArgs: cliArgs,
|
spawnArgs: spawnArgs,
|
||||||
outputFilePath: outputFilePath,
|
outputFilePath: outputFilePath,
|
||||||
}));
|
}));
|
||||||
args.updateWorker({
|
args.updateWorker({
|
||||||
CLIType: args.ffmpegPath,
|
CLIType: args.ffmpegPath,
|
||||||
preset: cliArgs.join(' '),
|
preset: spawnArgs.join(' '),
|
||||||
});
|
});
|
||||||
cli = new cliUtils_1.CLI({
|
cli = new cliUtils_1.CLI({
|
||||||
cli: args.ffmpegPath,
|
cli: args.ffmpegPath,
|
||||||
spawnArgs: cliArgs,
|
spawnArgs: spawnArgs,
|
||||||
spawnOpts: {},
|
spawnOpts: {},
|
||||||
jobLog: args.jobLog,
|
jobLog: args.jobLog,
|
||||||
outputFilePath: outputFilePath,
|
outputFilePath: outputFilePath,
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,8 @@ var CLI = /** @class */ (function () {
|
||||||
return [4 /*yield*/, new Promise(function (resolve) {
|
return [4 /*yield*/, new Promise(function (resolve) {
|
||||||
try {
|
try {
|
||||||
var opts = _this.config.spawnOpts || {};
|
var opts = _this.config.spawnOpts || {};
|
||||||
var thread = childProcess.spawn(_this.config.cli, _this.config.spawnArgs, opts);
|
var spawnArgs = _this.config.spawnArgs.map(function (row) { return row.trim(); }).filter(function (row) { return row !== ''; });
|
||||||
|
var thread = childProcess.spawn(_this.config.cli, spawnArgs, opts);
|
||||||
thread.stdout.on('data', function (data) {
|
thread.stdout.on('data', function (data) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
// console.log(data.toString());
|
// console.log(data.toString());
|
||||||
|
|
|
||||||
|
|
@ -141,20 +141,22 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
||||||
|
|
||||||
cliArgs.push(outputFilePath);
|
cliArgs.push(outputFilePath);
|
||||||
|
|
||||||
|
const spawnArgs = cliArgs.map((row) => row.trim()).filter((row) => row !== '');
|
||||||
|
|
||||||
args.jobLog('Processing file');
|
args.jobLog('Processing file');
|
||||||
args.jobLog(JSON.stringify({
|
args.jobLog(JSON.stringify({
|
||||||
cliArgs,
|
spawnArgs,
|
||||||
outputFilePath,
|
outputFilePath,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
args.updateWorker({
|
args.updateWorker({
|
||||||
CLIType: args.ffmpegPath,
|
CLIType: args.ffmpegPath,
|
||||||
preset: cliArgs.join(' '),
|
preset: spawnArgs.join(' '),
|
||||||
});
|
});
|
||||||
|
|
||||||
const cli = new CLI({
|
const cli = new CLI({
|
||||||
cli: args.ffmpegPath,
|
cli: args.ffmpegPath,
|
||||||
spawnArgs: cliArgs,
|
spawnArgs,
|
||||||
spawnOpts: {},
|
spawnOpts: {},
|
||||||
jobLog: args.jobLog,
|
jobLog: args.jobLog,
|
||||||
outputFilePath,
|
outputFilePath,
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,8 @@ class CLI {
|
||||||
const cliExitCode: number = await new Promise((resolve) => {
|
const cliExitCode: number = await new Promise((resolve) => {
|
||||||
try {
|
try {
|
||||||
const opts = this.config.spawnOpts || {};
|
const opts = this.config.spawnOpts || {};
|
||||||
const thread = childProcess.spawn(this.config.cli, this.config.spawnArgs, opts);
|
const spawnArgs = this.config.spawnArgs.map((row) => row.trim()).filter((row) => row !== '');
|
||||||
|
const thread = childProcess.spawn(this.config.cli, spawnArgs, opts);
|
||||||
|
|
||||||
thread.stdout.on('data', (data: string) => {
|
thread.stdout.on('data', (data: string) => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue