updated video encode to make audio/video optional

updated Executor to save output to variables
This commit is contained in:
reven
2022-01-01 12:12:37 +13:00
parent b5c71a9551
commit 15b9689c70
3 changed files with 110 additions and 70 deletions
+24
View File
@@ -3,6 +3,7 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Text.RegularExpressions;
using FileFlows.Plugin;
using FileFlows.Plugin.Attributes;
@@ -13,6 +14,8 @@
public override FlowElementType Type => FlowElementType.Process;
public override string Icon => "fas fa-terminal";
private const string VariablePattern = "^([a-zA-Z_]+)[a-zA-Z_0-9]*$";
[Required]
[File(1)]
public string FileName { get; set; }
@@ -31,6 +34,13 @@
[NumberInt(5)]
public int Timeout { get; set; }
[Text(6)]
[System.ComponentModel.DataAnnotations.RegularExpression(VariablePattern)]
public string OutputVariable { get; set; }
[Text(7)]
[System.ComponentModel.DataAnnotations.RegularExpression(VariablePattern)]
public string OutputErrorVariable { get; set; }
private NodeParameters args;
public override async Task Cancel()
@@ -58,6 +68,20 @@
return -1;
}
bool success = task.Result.ExitCode == this.SuccessCode;
if(Regex.IsMatch(OutputVariable ?? string.Empty, VariablePattern))
{
args.UpdateVariables(new Dictionary<string, object>
{
{ OutputVariable, task.Result.StandardOutput }
});
}
if (Regex.IsMatch(OutputErrorVariable ?? string.Empty, VariablePattern))
{
args.UpdateVariables(new Dictionary<string, object>
{
{ OutputErrorVariable, task.Result.StandardError }
});
}
if (success)
return 1;
else