From 34a3720c155db9dd5aa3fca1cc9a49dcd2d0953c Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 9 May 2024 08:17:53 +0100 Subject: [PATCH 1/6] Set Flow Variable --- .../tools/setFlowVariable/1.0.0/index.ts | 94 +++++++++++++++++++ .../1.0.0/interfaces/interfaces.ts | 2 +- 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts diff --git a/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts new file mode 100644 index 000000000..52f18b037 --- /dev/null +++ b/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts @@ -0,0 +1,94 @@ +import { + IpluginDetails, + IpluginInputArgs, + IpluginOutputArgs, +} from '../../../../FlowHelpers/1.0.0/interfaces/interfaces'; + +/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ +const details = (): IpluginDetails => ({ + name: 'Set Flow Variable', + description: `Set a Flow Variable to whatever you like. This can be used with the 'Check Flow Variable' + plugin for complex flows with loops in them where you're wanting to keep track + of where you are in the flow. For example, when attempting to transcode with NVENC, then QSV, then CPU. + `, + style: { + borderColor: 'green', + }, + tags: '', + isStartPlugin: false, + pType: '', + requiresVersion: '2.11.01', + sidebarPosition: 1, + icon: '', + inputs: [ + { + label: 'Variable', + name: 'variable', + type: 'string', + defaultValue: '', + inputUI: { + type: 'text', + }, + tooltip: `Variable to set. + + \\nExample\\n + transcodeStage + + \\n + You can then check this in the 'Check Flow Variable' plugin + {{{args.variables.user.transcodeStage}}} + `, + }, + { + label: 'Value', + name: 'value', + type: 'string', + defaultValue: '', + inputUI: { + type: 'text', + }, + tooltip: `Value to set. + + \\nExample\\n + 1 + + \\nExample\\n + nvenc + `, + }, + ], + outputs: [ + { + number: 1, + tooltip: 'Continue to next plugin', + }, + ], +}); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +const plugin = (args: IpluginInputArgs): IpluginOutputArgs => { + const lib = require('../../../../../methods/lib')(); + // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign + args.inputs = lib.loadDefaultValues(args.inputs, details); + + const variable = String(args.inputs.variable).trim(); + const value = String(args.inputs.value); + + if (!args.variables.user) { + args.variables.user = {}; + } + + args.jobLog(`Setting variable ${variable} to ${value}`); + + args.variables.user[variable] = value; + + return { + outputFileObj: args.inputFileObj, + outputNumber: 1, + variables: args.variables, + }; +}; +export { + details, + plugin, +}; diff --git a/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/interfaces.ts b/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/interfaces.ts index a1d5b0827..efb4c3685 100644 --- a/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/interfaces.ts +++ b/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/interfaces.ts @@ -98,7 +98,7 @@ export interface IffmpegCommand { export interface Ivariables { ffmpegCommand: IffmpegCommand, flowFailed: boolean, - inFlow: Record, + user: Record, } export interface IpluginOutputArgs { From 804bd33940e74e9888842420f05757eb8e43c8a0 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 9 May 2024 08:19:59 +0100 Subject: [PATCH 2/6] Ignore lint errors --- .../CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts index 52f18b037..b446661e5 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts @@ -75,11 +75,13 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => { const value = String(args.inputs.value); if (!args.variables.user) { + // eslint-disable-next-line no-param-reassign args.variables.user = {}; } args.jobLog(`Setting variable ${variable} to ${value}`); + // eslint-disable-next-line no-param-reassign args.variables.user[variable] = value; return { From 178c3df39358ff4d6d7b817564cc5d5bbb730076 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 9 May 2024 08:21:42 +0100 Subject: [PATCH 3/6] Fix Check Video Resolution typo --- .../video/checkVideoResolution/1.0.0/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlowPluginsTs/CommunityFlowPlugins/video/checkVideoResolution/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/video/checkVideoResolution/1.0.0/index.ts index 0e76a04e9..77fea926c 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/video/checkVideoResolution/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/video/checkVideoResolution/1.0.0/index.ts @@ -7,7 +7,7 @@ import { /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = ():IpluginDetails => ({ name: 'Check Video Resolution', - description: 'Check is video is 480p,576p,720p,1080p,1440p,4KUHD,DCI4K,8KUHD,Other', + description: 'Check if video is 480p,576p,720p,1080p,1440p,4KUHD,DCI4K,8KUHD,Other', style: { borderColor: 'orange', }, From 0bd4cb368ea2ec0c5abb9bfcca7e7d0c55d8f6eb Mon Sep 17 00:00:00 2001 From: HaveAGitGat Date: Thu, 9 May 2024 07:22:27 +0000 Subject: [PATCH 4/6] Apply auto-build changes --- .../tools/setFlowVariable/1.0.0/index.js | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 FlowPlugins/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.js diff --git a/FlowPlugins/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.js new file mode 100644 index 000000000..80eb6f705 --- /dev/null +++ b/FlowPlugins/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.js @@ -0,0 +1,67 @@ +"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 Flow Variable', + description: "Set a Flow Variable to whatever you like. This can be used with the 'Check Flow Variable'\n plugin for complex flows with loops in them where you're wanting to keep track \n of where you are in the flow. For example, when attempting to transcode with NVENC, then QSV, then CPU.\n ", + style: { + borderColor: 'green', + }, + tags: '', + isStartPlugin: false, + pType: '', + requiresVersion: '2.11.01', + sidebarPosition: 1, + icon: '', + inputs: [ + { + label: 'Variable', + name: 'variable', + type: 'string', + defaultValue: '', + inputUI: { + type: 'text', + }, + tooltip: "Variable to set.\n \n \\nExample\\n\n transcodeStage\n \n \\n\n You can then check this in the 'Check Flow Variable' plugin\n {{{args.variables.user.transcodeStage}}}\n ", + }, + { + label: 'Value', + name: 'value', + type: 'string', + defaultValue: '', + inputUI: { + type: 'text', + }, + tooltip: "Value to set.\n \n \\nExample\\n\n 1\n \n \\nExample\\n\n nvenc\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 variable = String(args.inputs.variable).trim(); + var value = String(args.inputs.value); + if (!args.variables.user) { + // eslint-disable-next-line no-param-reassign + args.variables.user = {}; + } + args.jobLog("Setting variable ".concat(variable, " to ").concat(value)); + // eslint-disable-next-line no-param-reassign + args.variables.user[variable] = value; + return { + outputFileObj: args.inputFileObj, + outputNumber: 1, + variables: args.variables, + }; +}; +exports.plugin = plugin; From f2e97ae97594371210dc407b16a89c1e31dca645 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 9 May 2024 08:26:42 +0100 Subject: [PATCH 5/6] Adjust desc --- .../CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts index b446661e5..7a0639d5c 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.ts @@ -9,8 +9,7 @@ const details = (): IpluginDetails => ({ name: 'Set Flow Variable', description: `Set a Flow Variable to whatever you like. This can be used with the 'Check Flow Variable' plugin for complex flows with loops in them where you're wanting to keep track - of where you are in the flow. For example, when attempting to transcode with NVENC, then QSV, then CPU. - `, + of where you are in the flow. For example, when attempting to transcode with NVENC, then QSV, then CPU.`, style: { borderColor: 'green', }, From d60d96429cb8d116f6b424f2dbfdd1b23c667116 Mon Sep 17 00:00:00 2001 From: HaveAGitGat Date: Thu, 9 May 2024 07:29:05 +0000 Subject: [PATCH 6/6] Apply auto-build changes --- .../CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.js | 2 +- .../video/checkVideoResolution/1.0.0/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FlowPlugins/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.js index 80eb6f705..ca76eb8dc 100644 --- a/FlowPlugins/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/tools/setFlowVariable/1.0.0/index.js @@ -4,7 +4,7 @@ exports.plugin = exports.details = void 0; /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Set Flow Variable', - description: "Set a Flow Variable to whatever you like. This can be used with the 'Check Flow Variable'\n plugin for complex flows with loops in them where you're wanting to keep track \n of where you are in the flow. For example, when attempting to transcode with NVENC, then QSV, then CPU.\n ", + description: "Set a Flow Variable to whatever you like. This can be used with the 'Check Flow Variable'\n plugin for complex flows with loops in them where you're wanting to keep track \n of where you are in the flow. For example, when attempting to transcode with NVENC, then QSV, then CPU.", style: { borderColor: 'green', }, diff --git a/FlowPlugins/CommunityFlowPlugins/video/checkVideoResolution/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/video/checkVideoResolution/1.0.0/index.js index bb965c448..b91bb6c7f 100644 --- a/FlowPlugins/CommunityFlowPlugins/video/checkVideoResolution/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/video/checkVideoResolution/1.0.0/index.js @@ -4,7 +4,7 @@ exports.plugin = exports.details = void 0; /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Check Video Resolution', - description: 'Check is video is 480p,576p,720p,1080p,1440p,4KUHD,DCI4K,8KUHD,Other', + description: 'Check if video is 480p,576p,720p,1080p,1440p,4KUHD,DCI4K,8KUHD,Other', style: { borderColor: 'orange', },