From 82a2a7bca17190d6e39ee5ea58762f37dbbdbb95 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 26 Jan 2025 21:37:35 +0000 Subject: [PATCH 1/2] Add example info to Custom JS Function --- .../tools/customFunction/1.0.0/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/FlowPluginsTs/CommunityFlowPlugins/tools/customFunction/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/tools/customFunction/1.0.0/index.ts index fcd01e7..7d24f28 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/tools/customFunction/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/tools/customFunction/1.0.0/index.ts @@ -1,3 +1,5 @@ +/* eslint-disable max-len */ + import { promises as fsp } from 'fs'; import { getPluginWorkDir } from '../../../../FlowHelpers/1.0.0/fileUtils'; import { @@ -27,6 +29,23 @@ const details = (): IpluginDetails => ({ defaultValue: ` module.exports = async (args) => { +// see args object data here https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/interfaces.ts +// example setting flow variable: https://github.com/HaveAGitGat/Tdarr/issues/1147#issuecomment-2593348443 +// example reading ffmpeg metadata: https://github.com/HaveAGitGat/Tdarr_Plugins/issues/737#issuecomment-2581536112 + +// some example file data: +console.log(args.inputFileObj._id) +console.log(args.inputFileObj.file_size) +console.log(args.inputFileObj.ffProbeData.streams[0].codec_name) +console.log(args.inputFileObj.mediaInfo.track[0].BitRate) + +// access global variable: +console.log(args.userVariables.global.test) +// access library variable: +console.log(args.userVariables.library.test) + + + // do something here return { From fd66a2329204d2d3f2638c6240efcfcb71da2b7e Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 26 Jan 2025 21:39:17 +0000 Subject: [PATCH 2/2] Apply auto-build changes --- .../CommunityFlowPlugins/tools/customFunction/1.0.0/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FlowPlugins/CommunityFlowPlugins/tools/customFunction/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/tools/customFunction/1.0.0/index.js index 69feb0d..e0a5cb2 100644 --- a/FlowPlugins/CommunityFlowPlugins/tools/customFunction/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/tools/customFunction/1.0.0/index.js @@ -1,4 +1,5 @@ "use strict"; +/* eslint-disable max-len */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -57,7 +58,7 @@ var details = function () { return ({ label: 'JS Code', name: 'code', type: 'string', - defaultValue: "\nmodule.exports = async (args) => {\n\n// do something here\n\n return {\n outputFileObj: args.inputFileObj,\n outputNumber: 1,\n variables: args.variables,\n };\n}\n ", + defaultValue: "\nmodule.exports = async (args) => {\n\n// see args object data here https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/FlowPluginsTs/FlowHelpers/1.0.0/interfaces/interfaces.ts\n// example setting flow variable: https://github.com/HaveAGitGat/Tdarr/issues/1147#issuecomment-2593348443\n// example reading ffmpeg metadata: https://github.com/HaveAGitGat/Tdarr_Plugins/issues/737#issuecomment-2581536112\n\n// some example file data:\nconsole.log(args.inputFileObj._id)\nconsole.log(args.inputFileObj.file_size)\nconsole.log(args.inputFileObj.ffProbeData.streams[0].codec_name)\nconsole.log(args.inputFileObj.mediaInfo.track[0].BitRate)\n\n// access global variable:\nconsole.log(args.userVariables.global.test)\n// access library variable:\nconsole.log(args.userVariables.library.test)\n\n\n\n// do something here\n\n return {\n outputFileObj: args.inputFileObj,\n outputNumber: 1,\n variables: args.variables,\n };\n}\n ", inputUI: { type: 'textarea', style: {