mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 07:29:04 -07:00
commit
34b29bcf4a
4 changed files with 69 additions and 8 deletions
|
|
@ -4,10 +4,9 @@ exports.plugin = exports.details = void 0;
|
|||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||
var details = function () { return ({
|
||||
name: 'Custom Arguments',
|
||||
description: 'Custom Arguments',
|
||||
description: 'Set FFmpeg custome input and output arguments',
|
||||
style: {
|
||||
borderColor: '#6efefc',
|
||||
opacity: 0.5,
|
||||
},
|
||||
tags: 'video',
|
||||
isStartPlugin: false,
|
||||
|
|
@ -15,7 +14,26 @@ var details = function () { return ({
|
|||
requiresVersion: '2.11.01',
|
||||
sidebarPosition: -1,
|
||||
icon: '',
|
||||
inputs: [],
|
||||
inputs: [
|
||||
{
|
||||
name: 'inputArguments',
|
||||
type: 'string',
|
||||
defaultValue: '',
|
||||
inputUI: {
|
||||
type: 'text',
|
||||
},
|
||||
tooltip: 'Specify input arguments',
|
||||
},
|
||||
{
|
||||
name: 'outputArguments',
|
||||
type: 'string',
|
||||
defaultValue: '',
|
||||
inputUI: {
|
||||
type: 'text',
|
||||
},
|
||||
tooltip: 'Specify output arguments',
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
number: 1,
|
||||
|
|
@ -26,9 +44,18 @@ var details = function () { return ({
|
|||
exports.details = details;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
var plugin = function (args) {
|
||||
var _a, _b;
|
||||
var lib = require('../../../../../methods/lib')();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
||||
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
||||
var inputArguments = String(args.inputs.inputArguments);
|
||||
var outputArguments = String(args.inputs.outputArguments);
|
||||
if (inputArguments) {
|
||||
(_a = args.variables.ffmpegCommand.overallInputArguments).push.apply(_a, inputArguments.split(' '));
|
||||
}
|
||||
if (outputArguments) {
|
||||
(_b = args.variables.ffmpegCommand.overallOuputArguments).push.apply(_b, outputArguments.split(' '));
|
||||
}
|
||||
return {
|
||||
outputFileObj: args.inputFileObj,
|
||||
outputNumber: 1,
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
|||
cliArgs.push('-y');
|
||||
cliArgs.push('-i');
|
||||
cliArgs.push(args.inputFileObj._id);
|
||||
inputArgs = [];
|
||||
inputArgs = __spreadArray([], args.variables.ffmpegCommand.overallInputArguments, true);
|
||||
_a = args.variables.ffmpegCommand, shouldProcess = _a.shouldProcess, streams = _a.streams;
|
||||
streams = streams.filter(function (stream) {
|
||||
if (stream.removed) {
|
||||
|
|
@ -150,6 +150,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
|
|||
}
|
||||
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))
|
||||
+ ".".concat(args.variables.ffmpegCommand.container);
|
||||
cliArgs.push(outputFilePath);
|
||||
|
|
|
|||
|
|
@ -7,10 +7,9 @@ import {
|
|||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||
const details = () :IpluginDetails => ({
|
||||
name: 'Custom Arguments',
|
||||
description: 'Custom Arguments',
|
||||
description: 'Set FFmpeg custome input and output arguments',
|
||||
style: {
|
||||
borderColor: '#6efefc',
|
||||
opacity: 0.5,
|
||||
},
|
||||
tags: 'video',
|
||||
isStartPlugin: false,
|
||||
|
|
@ -18,7 +17,27 @@ const details = () :IpluginDetails => ({
|
|||
requiresVersion: '2.11.01',
|
||||
sidebarPosition: -1,
|
||||
icon: '',
|
||||
inputs: [],
|
||||
inputs: [
|
||||
{
|
||||
name: 'inputArguments',
|
||||
type: 'string',
|
||||
defaultValue: '',
|
||||
inputUI: {
|
||||
type: 'text',
|
||||
},
|
||||
tooltip: 'Specify input arguments',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'outputArguments',
|
||||
type: 'string',
|
||||
defaultValue: '',
|
||||
inputUI: {
|
||||
type: 'text',
|
||||
},
|
||||
tooltip: 'Specify output arguments',
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
number: 1,
|
||||
|
|
@ -33,6 +52,17 @@ const plugin = (args:IpluginInputArgs):IpluginOutputArgs => {
|
|||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
||||
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
||||
|
||||
const inputArguments = String(args.inputs.inputArguments);
|
||||
const outputArguments = String(args.inputs.outputArguments);
|
||||
|
||||
if (inputArguments) {
|
||||
args.variables.ffmpegCommand.overallInputArguments.push(...inputArguments.split(' '));
|
||||
}
|
||||
|
||||
if (outputArguments) {
|
||||
args.variables.ffmpegCommand.overallOuputArguments.push(...outputArguments.split(' '));
|
||||
}
|
||||
|
||||
return {
|
||||
outputFileObj: args.inputFileObj,
|
||||
outputNumber: 1,
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ const plugin = async (args: IpluginInputArgs): Promise<IpluginOutputArgs> => {
|
|||
cliArgs.push('-i');
|
||||
cliArgs.push(args.inputFileObj._id);
|
||||
|
||||
const inputArgs: string[] = [];
|
||||
const inputArgs: string[] = [
|
||||
...args.variables.ffmpegCommand.overallInputArguments,
|
||||
];
|
||||
let { shouldProcess, streams } = args.variables.ffmpegCommand;
|
||||
|
||||
streams = streams.filter((stream) => {
|
||||
|
|
@ -123,6 +125,7 @@ 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)}`
|
||||
+ `.${args.variables.ffmpegCommand.container}`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue