diff --git a/BasicNodes/BasicNodes.en.json b/BasicNodes/BasicNodes.en.json index 481d642c..802d2468 100644 --- a/BasicNodes/BasicNodes.en.json +++ b/BasicNodes/BasicNodes.en.json @@ -184,6 +184,13 @@ "Flow": "Flow" } }, + "Reprocess": { + "Description": "The flow element allows you to reprocess the original library file with a different processing node.\n\n If the same processing node is selected as the one currently processing the file, the flow will fail.", + "Fields": { + "Node": "Node", + "Node-Help": "The processing node to process this file." + } + }, "Log": { "Description": "Logs a message to the flow log", "Outputs": { diff --git a/BasicNodes/Functions/GotoFlow.cs b/BasicNodes/Functions/GotoFlow.cs index 7bf6d32c..09dcc732 100644 --- a/BasicNodes/Functions/GotoFlow.cs +++ b/BasicNodes/Functions/GotoFlow.cs @@ -1,25 +1,34 @@ -namespace FileFlows.BasicNodes.Functions +using FileFlows.Plugin; +using FileFlows.Plugin.Attributes; + +namespace FileFlows.BasicNodes.Functions; + +/// +/// Flow element that moves process into another flow +/// +public class GotoFlow : Node { - using FileFlows.Plugin; - using FileFlows.Plugin.Attributes; + /// + public override int Inputs => 1; + /// + public override int Outputs => 0; + /// + public override FlowElementType Type => FlowElementType.Logic; + /// + public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/goto-flow"; + /// + public override string Icon => "fas fa-sitemap"; + + /// + /// Gets or sets the flow to execute + /// + [Select("FLOW_LIST", 1)] + public ObjectReference Flow { get; set; } - public class GotoFlow : Node + /// + public override int Execute(NodeParameters args) { - public override int Inputs => 1; - public override int Outputs => 0; - - public override FlowElementType Type => FlowElementType.Logic; - public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/goto-flow"; - public override string Icon => "fas fa-sitemap"; - - [Select("FLOW_LIST", 1)] - public ObjectReference Flow { get; set; } - - - public override int Execute(NodeParameters args) - { - args.GotoFlow(Flow); - return 0; - } + args.GotoFlow(Flow); + return 0; } -} \ No newline at end of file +} diff --git a/BasicNodes/Functions/Reprocess.cs b/BasicNodes/Functions/Reprocess.cs new file mode 100644 index 00000000..3c11f888 --- /dev/null +++ b/BasicNodes/Functions/Reprocess.cs @@ -0,0 +1,42 @@ +using FileFlows.Plugin; +using FileFlows.Plugin.Attributes; + +namespace FileFlows.BasicNodes.Functions; + +/// +/// Flow element that moves a file for reprocessing +/// +public class Reprocess : Node +{ + /// + public override int Inputs => 1; + /// + public override int Outputs => 0; + /// + public override FlowElementType Type => FlowElementType.Process; + /// + public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/reprocess"; + /// + public override string Icon => "fas fa-redo"; + + /// + /// Gets or sets the flow to execute + /// + [Select("NODE_LIST", 1)] + public ObjectReference Node { get; set; } + + /// + public override int Execute(NodeParameters args) + { + if (Node.Uid == args.Node.Uid) + { + args.FailureReason = "Target reprocess node is same as current processing node."; + args.Logger?.ELog(args.FailureReason); + return -1; + } + args.Logger?.ILog("Requesting reprocessing on Node: " + Node.Name); + args.ReprocessNode = Node; + + return 0; + } +} diff --git a/FileFlows.Plugin.dll b/FileFlows.Plugin.dll index 0a3f3116..2a8db20e 100644 Binary files a/FileFlows.Plugin.dll and b/FileFlows.Plugin.dll differ diff --git a/FileFlows.Plugin.pdb b/FileFlows.Plugin.pdb index bf3cda5a..d640a9f7 100644 Binary files a/FileFlows.Plugin.pdb and b/FileFlows.Plugin.pdb differ