mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 07:29:04 -07:00
commit
0ddc56b929
5 changed files with 15 additions and 10 deletions
|
|
@ -96,7 +96,7 @@ var getOuputStreamTypeIndex = function (streams, stream) {
|
|||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
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) {
|
||||
switch (_b.label) {
|
||||
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))
|
||||
+ ".".concat(args.variables.ffmpegCommand.container);
|
||||
cliArgs.push(outputFilePath);
|
||||
spawnArgs = cliArgs.map(function (row) { return row.trim(); }).filter(function (row) { return row !== ''; });
|
||||
args.jobLog('Processing file');
|
||||
args.jobLog(JSON.stringify({
|
||||
cliArgs: cliArgs,
|
||||
spawnArgs: spawnArgs,
|
||||
outputFilePath: outputFilePath,
|
||||
}));
|
||||
args.updateWorker({
|
||||
CLIType: args.ffmpegPath,
|
||||
preset: cliArgs.join(' '),
|
||||
preset: spawnArgs.join(' '),
|
||||
});
|
||||
cli = new cliUtils_1.CLI({
|
||||
cli: args.ffmpegPath,
|
||||
spawnArgs: cliArgs,
|
||||
spawnArgs: spawnArgs,
|
||||
spawnOpts: {},
|
||||
jobLog: args.jobLog,
|
||||
outputFilePath: outputFilePath,
|
||||
|
|
|
|||
|
|
@ -229,7 +229,8 @@ var CLI = /** @class */ (function () {
|
|||
return [4 /*yield*/, new Promise(function (resolve) {
|
||||
try {
|
||||
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) {
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log(data.toString());
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ var hasEncoder = function (_a) {
|
|||
'/dev/null',
|
||||
], false);
|
||||
args.jobLog("Checking for encoder ".concat(encoder, " with command:"));
|
||||
args.jobLog(ffmpegPath + ' ' + commandArr_1.join(' '));
|
||||
args.jobLog("".concat(ffmpegPath, " ").concat(commandArr_1.join(' ')));
|
||||
return [4 /*yield*/, new Promise(function (resolve) {
|
||||
var error = function () {
|
||||
resolve(false);
|
||||
|
|
|
|||
|
|
@ -141,20 +141,22 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
|||
|
||||
cliArgs.push(outputFilePath);
|
||||
|
||||
const spawnArgs = cliArgs.map((row) => row.trim()).filter((row) => row !== '');
|
||||
|
||||
args.jobLog('Processing file');
|
||||
args.jobLog(JSON.stringify({
|
||||
cliArgs,
|
||||
spawnArgs,
|
||||
outputFilePath,
|
||||
}));
|
||||
|
||||
args.updateWorker({
|
||||
CLIType: args.ffmpegPath,
|
||||
preset: cliArgs.join(' '),
|
||||
preset: spawnArgs.join(' '),
|
||||
});
|
||||
|
||||
const cli = new CLI({
|
||||
cli: args.ffmpegPath,
|
||||
spawnArgs: cliArgs,
|
||||
spawnArgs,
|
||||
spawnOpts: {},
|
||||
jobLog: args.jobLog,
|
||||
outputFilePath,
|
||||
|
|
|
|||
|
|
@ -244,7 +244,8 @@ class CLI {
|
|||
const cliExitCode: number = await new Promise((resolve) => {
|
||||
try {
|
||||
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) => {
|
||||
// eslint-disable-next-line no-console
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue