mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-30 22:30:16 -06:00
FF-152 - saving pattern match match to "PatternMatch" variable
added help links to image and audio nodes
This commit is contained in:
@@ -9,6 +9,8 @@ namespace FileFlows.AudioNodes
|
||||
public override int Outputs => 1;
|
||||
public override FlowElementType Type => FlowElementType.Input;
|
||||
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/audio-nodes/audio-file";
|
||||
|
||||
private Dictionary<string, object> _Variables;
|
||||
public override Dictionary<string, object> Variables => _Variables;
|
||||
public AudioFile()
|
||||
|
||||
@@ -9,6 +9,7 @@ public class AudioFileNormalization : AudioNode
|
||||
public override int Inputs => 1;
|
||||
public override int Outputs => 1;
|
||||
public override FlowElementType Type => FlowElementType.Process;
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/audio-nodes/audio-file-normalization";
|
||||
|
||||
public override string Icon => "fas fa-volume-up";
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace FileFlows.AudioNodes
|
||||
{
|
||||
public class ConvertToMP3 : ConvertNode
|
||||
{
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/audio-nodes/convert-to-mp3";
|
||||
protected override string Extension => "mp3";
|
||||
public static List<ListOption> BitrateOptions => ConvertNode.BitrateOptions;
|
||||
protected override List<string> GetArguments()
|
||||
@@ -26,6 +27,7 @@ namespace FileFlows.AudioNodes
|
||||
}
|
||||
public class ConvertToWAV : ConvertNode
|
||||
{
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/audio-nodes/convert-to-wav";
|
||||
protected override string Extension => "wav";
|
||||
public static List<ListOption> BitrateOptions => ConvertNode.BitrateOptions;
|
||||
protected override List<string> GetArguments()
|
||||
@@ -42,6 +44,7 @@ namespace FileFlows.AudioNodes
|
||||
|
||||
public class ConvertToAAC : ConvertNode
|
||||
{
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/audio-nodes/convert-to-aac";
|
||||
protected override string Extension => "aac";
|
||||
public static List<ListOption> BitrateOptions => ConvertNode.BitrateOptions;
|
||||
|
||||
@@ -60,6 +63,7 @@ namespace FileFlows.AudioNodes
|
||||
}
|
||||
public class ConvertToOGG: ConvertNode
|
||||
{
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/audio-nodes/convert-to-ogg";
|
||||
protected override string Extension => "ogg";
|
||||
public static List<ListOption> BitrateOptions => ConvertNode.BitrateOptions;
|
||||
protected override List<string> GetArguments()
|
||||
@@ -93,6 +97,7 @@ namespace FileFlows.AudioNodes
|
||||
public class ConvertAudio : ConvertNode
|
||||
{
|
||||
protected override string Extension => Codec;
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/audio-nodes/convert-audio";
|
||||
|
||||
public static List<ListOption> BitrateOptions => ConvertNode.BitrateOptions;
|
||||
|
||||
|
||||
@@ -1,40 +1,57 @@
|
||||
namespace FileFlows.BasicNodes.Functions
|
||||
namespace FileFlows.BasicNodes.Functions;
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.RegularExpressions;
|
||||
using FileFlows.Plugin;
|
||||
using FileFlows.Plugin.Attributes;
|
||||
public class PatternMatch : Node
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.RegularExpressions;
|
||||
using FileFlows.Plugin;
|
||||
using FileFlows.Plugin.Attributes;
|
||||
public class PatternMatch : Node
|
||||
public override int Inputs => 1;
|
||||
public override int Outputs => 2;
|
||||
public override FlowElementType Type => FlowElementType.Logic;
|
||||
public override string Icon => "fas fa-equals";
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/basic-nodes/pattern-match";
|
||||
|
||||
private Dictionary<string, object> _Variables;
|
||||
public override Dictionary<string, object> Variables => _Variables;
|
||||
public PatternMatch()
|
||||
{
|
||||
public override int Inputs => 1;
|
||||
public override int Outputs => 2;
|
||||
public override FlowElementType Type => FlowElementType.Logic;
|
||||
public override string Icon => "fas fa-equals";
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/basic-nodes/pattern-match";
|
||||
|
||||
[DefaultValue("")]
|
||||
[Text(1)]
|
||||
[Required]
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public override int Execute(NodeParameters args)
|
||||
_Variables = new Dictionary<string, object>()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Pattern))
|
||||
return 1; // no pattern, matches everything
|
||||
{ "PatternMatch", "match from pattern" }
|
||||
};
|
||||
}
|
||||
|
||||
try
|
||||
[DefaultValue("")]
|
||||
[Text(1)]
|
||||
[Required]
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public override int Execute(NodeParameters args)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Pattern))
|
||||
return 1; // no pattern, matches everything
|
||||
|
||||
try
|
||||
{
|
||||
var rgx = new Regex(Pattern);
|
||||
if (rgx.IsMatch(args.WorkingFile))
|
||||
{
|
||||
var rgx = new Regex(Pattern);
|
||||
if (rgx.IsMatch(args.WorkingFile) || rgx.IsMatch(args.FileName))
|
||||
return 1;
|
||||
return 2;
|
||||
args.Variables.Add("PatternMatch", rgx.Match(args.WorkingFile).Value);
|
||||
return 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
if (rgx.IsMatch(args.FileName))
|
||||
{
|
||||
args.Logger?.ELog("Pattern error: " + ex.Message);
|
||||
return -1;
|
||||
args.Variables.Add("PatternMatch", rgx.Match(args.FileName).Value);
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
args.Logger?.ELog("Pattern error: " + ex.Message);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ public class ImageFile : ImageBaseNode
|
||||
{
|
||||
public override int Outputs => 1;
|
||||
public override FlowElementType Type => FlowElementType.Input;
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/image-nodes/image-file";
|
||||
|
||||
public override string Icon => "fas fa-file-image";
|
||||
|
||||
@@ -16,7 +17,7 @@ public class ImageFile : ImageBaseNode
|
||||
_Variables = new Dictionary<string, object>()
|
||||
{
|
||||
{ "img.Width", 1920 },
|
||||
{ "img.Heigh", 1080 },
|
||||
{ "img.Height", 1080 },
|
||||
{ "img.Format", "PNG" },
|
||||
{ "img.IsPortrait", true },
|
||||
{ "img.IsLandscape", false }
|
||||
|
||||
@@ -7,7 +7,8 @@ public class ImageFlip: ImageNode
|
||||
{
|
||||
public override int Inputs => 1;
|
||||
public override int Outputs => 1;
|
||||
public override FlowElementType Type => FlowElementType.Process;
|
||||
public override FlowElementType Type => FlowElementType.Process;
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/image-nodes/image-flip";
|
||||
public override string Icon => "fas fa-sync-alt";
|
||||
|
||||
[Boolean(2)]
|
||||
|
||||
@@ -6,7 +6,9 @@ public class ImageFormat: ImageNode
|
||||
{
|
||||
public override int Inputs => 1;
|
||||
public override int Outputs => 2;
|
||||
public override FlowElementType Type => FlowElementType.Process;
|
||||
public override FlowElementType Type => FlowElementType.Process;
|
||||
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/image-nodes/image-format";
|
||||
public override string Icon => "fas fa-file-image";
|
||||
|
||||
public override int Execute(NodeParameters args)
|
||||
|
||||
@@ -7,6 +7,8 @@ public class ImageIsLandscape: ImageBaseNode
|
||||
public override FlowElementType Type => FlowElementType.Logic;
|
||||
public override string Icon => "fas fa-image";
|
||||
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/image-nodes/image-is-landscape";
|
||||
|
||||
|
||||
public override int Execute(NodeParameters args)
|
||||
{
|
||||
|
||||
@@ -17,8 +17,10 @@ public class ImageResizer: ImageNode
|
||||
public override int Outputs => 1;
|
||||
public override FlowElementType Type => FlowElementType.Process;
|
||||
public override string Icon => "fas fa-expand";
|
||||
|
||||
|
||||
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/image-nodes/image-resizer";
|
||||
|
||||
|
||||
[Select(nameof(ResizeModes), 2)]
|
||||
public ResizeMode Mode { get; set; }
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ public class ImageRotate: ImageNode
|
||||
public override FlowElementType Type => FlowElementType.Process;
|
||||
public override string Icon => "fas fa-undo";
|
||||
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/image-nodes/image-rotate";
|
||||
|
||||
[Select(nameof(AngleOptions), 2)]
|
||||
public int Angle { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user