mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-10 07:50:29 -07:00
Update flows
This commit is contained in:
parent
658857fdf4
commit
25c4fab8d9
73 changed files with 4295 additions and 839 deletions
|
|
@ -0,0 +1,83 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.plugin = exports.details = void 0;
|
||||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||
var details = function () { return ({
|
||||
name: 'Set Video Resolution',
|
||||
description: 'Change video resolution',
|
||||
style: {
|
||||
borderColor: '#6efefc',
|
||||
},
|
||||
tags: 'video',
|
||||
isStartPlugin: false,
|
||||
sidebarPosition: -1,
|
||||
icon: '',
|
||||
inputs: [
|
||||
{
|
||||
name: 'targetResolution',
|
||||
type: 'string',
|
||||
defaultValue: '1080p',
|
||||
inputUI: {
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
'480p',
|
||||
'720p',
|
||||
'1080p',
|
||||
'1440p',
|
||||
'4KUHD',
|
||||
],
|
||||
},
|
||||
tooltip: 'Specify the codec to use',
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
number: 1,
|
||||
tooltip: 'Continue to next plugin',
|
||||
},
|
||||
],
|
||||
}); };
|
||||
exports.details = details;
|
||||
var getVfScale = function (targetResolution) {
|
||||
switch (targetResolution) {
|
||||
case '480p':
|
||||
return ['-vf', 'scale=720:-2'];
|
||||
case '576p':
|
||||
return ['-vf', 'scale=720:-2'];
|
||||
case '720p':
|
||||
return ['-vf', 'scale=1280:-2'];
|
||||
case '1080p':
|
||||
return ['-vf', 'scale=1920:-2'];
|
||||
case '1440p':
|
||||
return ['-vf', 'scale=2560:-2'];
|
||||
case '4KUHD':
|
||||
return ['-vf', 'scale=3840:-2'];
|
||||
default:
|
||||
return ['-vf', 'scale=1920:-2'];
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
var plugin = function (args) {
|
||||
var _a;
|
||||
var lib = require('../../../../../methods/lib')();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
||||
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
||||
for (var i = 0; i < args.variables.ffmpegCommand.streams.length; i += 1) {
|
||||
var stream = args.variables.ffmpegCommand.streams[i];
|
||||
if (stream.codec_type === 'video') {
|
||||
var targetResolution = String(args.inputs.targetResolution);
|
||||
if (targetResolution !== args.inputFileObj.video_resolution) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
args.variables.ffmpegCommand.shouldProcess = true;
|
||||
var scaleArgs = getVfScale(targetResolution);
|
||||
(_a = stream.outputArgs).push.apply(_a, scaleArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
outputFileObj: args.inputFileObj,
|
||||
outputNumber: 1,
|
||||
variables: args.variables,
|
||||
};
|
||||
};
|
||||
exports.plugin = plugin;
|
||||
Loading…
Add table
Add a link
Reference in a new issue