Skip to content

Commit

Permalink
Merge pull request #663 from HaveAGitGat/compare_live
Browse files Browse the repository at this point in the history
Compare File Size Ratio Live
  • Loading branch information
HaveAGitGat committed Jun 12, 2024
2 parents 6d6ff0b + eeee40c commit d9b8ce4
Show file tree
Hide file tree
Showing 27 changed files with 479 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 1:
Expand Down Expand Up @@ -181,6 +182,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli2.runCli()];
case 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 1:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
"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: 'Compare File Size Ratio Live',
description: "\n Compare either the estimated final size or current output size to the input size and \n give an error if estimated final size or current size surpasses the threshold %.\n\n Works with 'FfmpegCommand', 'HandBrake Custom Arguments', 'Run Classic Transcode' and other flow plugins \n that output a file.\n\n Can be placed anywhere before a plugin which outputs a new file.\n ',\n ",
style: {
borderColor: 'orange',
},
tags: '',
isStartPlugin: false,
pType: '',
requiresVersion: '2.11.01',
sidebarPosition: -1,
icon: 'faQuestion',
inputs: [
{
label: 'Enabled',
name: 'enabled',
type: 'boolean',
defaultValue: 'true',
inputUI: {
type: 'switch',
},
tooltip: "Enable or disable this plugin. For example you may want to enable it for one transcoding block and then\n disable it for another block.\n ",
},
{
label: 'Compare Method',
name: 'compareMethod',
type: 'string',
defaultValue: 'estimatedFinalSize',
inputUI: {
type: 'dropdown',
options: [
'estimatedFinalSize',
'currentSize',
],
displayConditions: {
logic: 'AND',
sets: [
{
logic: 'AND',
inputs: [
{
name: 'enabled',
value: 'true',
condition: '===',
},
],
},
],
},
},
tooltip: "Specify the method to compare.\n Estimated Final Size: Compare the estimated final output size to the input size.\n Current Size: Compare the current output size to the input size.\n ",
},
{
label: 'Threshold Size %',
name: 'thresholdPerc',
type: 'number',
defaultValue: '60',
inputUI: {
type: 'text',
displayConditions: {
logic: 'AND',
sets: [
{
logic: 'AND',
inputs: [
{
name: 'enabled',
value: 'true',
condition: '===',
},
],
},
],
},
},
tooltip: "Enter the threshold size percentage relative to the input size. \n An error will be triggered if the estimated or current size exceeds this percentage.\n\n For example, if the input size is 100MB and the threshold is 60%, the estimated final size or current size\n must not surpass 60MB else an error will be given and processing will stop.\n ",
},
{
label: 'Check Delay (seconds)',
name: 'checkDelaySeconds',
type: 'number',
defaultValue: '20',
inputUI: {
type: 'text',
displayConditions: {
logic: 'AND',
sets: [
{
logic: 'AND',
inputs: [
{
name: 'enabled',
value: 'true',
condition: '===',
},
],
},
],
},
},
tooltip: "\n Specify the delay in seconds before beginning the comparison.\n A larger delay gives more time for the estimated final size to stabilize.\n ",
},
],
outputs: [
{
number: 1,
tooltip: 'Continue to next plugin',
},
],
}); };
exports.details = details;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var plugin = function (args) {
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 enabled = Boolean(args.inputs.enabled);
var compareMethod = String(args.inputs.compareMethod);
var thresholdPerc = Number(args.inputs.thresholdPerc);
var checkDelaySeconds = Number(args.inputs.checkDelaySeconds);
// eslint-disable-next-line no-param-reassign
args.variables.liveSizeCompare = {
enabled: enabled,
compareMethod: compareMethod,
thresholdPerc: thresholdPerc,
checkDelaySeconds: checkDelaySeconds,
};
return {
outputFileObj: args.inputFileObj,
outputNumber: 1,
variables: args.variables,
};
};
exports.plugin = plugin;
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 4:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 4:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var details = function () { return ({
tags: '',
isStartPlugin: false,
pType: '',
requiresVersion: '2.11.01',
requiresVersion: '2.18.01',
sidebarPosition: -1,
icon: 'faBell',
inputs: [
Expand Down Expand Up @@ -104,6 +104,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function
inputFileObj: args.inputFileObj,
logFullCliOutput: args.logFullCliOutput,
updateWorker: args.updateWorker,
args: args,
});
return [4 /*yield*/, cli.runCli()];
case 1:
Expand Down
Loading

0 comments on commit d9b8ce4

Please sign in to comment.