mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-20 21:39:42 -06:00
FF-1252 - new flow element video already processed
This commit is contained in:
Binary file not shown.
Binary file not shown.
52
VideoNodes/LogicalNodes/VideoAlreadyProcessed.cs
Normal file
52
VideoNodes/LogicalNodes/VideoAlreadyProcessed.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
namespace FileFlows.VideoNodes;
|
||||
|
||||
/// <summary>
|
||||
/// Flow element to test if a video file has already been processed, this is done by looking for the FileFlows comment
|
||||
/// </summary>
|
||||
public class VideoAlreadyProcessed : VideoNode
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the number of inputs
|
||||
/// </summary>
|
||||
public override int Inputs => 1;
|
||||
/// <summary>
|
||||
/// Gets the number of outputs
|
||||
/// </summary>
|
||||
public override int Outputs => 2;
|
||||
/// <summary>
|
||||
/// Gets the type of flow element
|
||||
/// </summary>
|
||||
public override FlowElementType Type => FlowElementType.Logic;
|
||||
/// <summary>
|
||||
/// Gets the help URL
|
||||
/// </summary>
|
||||
public override string HelpUrl => "https://fileflows.com/docs/plugins/video-nodes/logical-nodes/video-already-processed";
|
||||
/// <inheritdoc />
|
||||
public override string Icon => "fas fa-running";
|
||||
|
||||
/// <summary>
|
||||
/// Executes the flow element
|
||||
/// </summary>
|
||||
/// <param name="args">the arguments</param>
|
||||
/// <returns>the output to call next</returns>
|
||||
public override int Execute(NodeParameters args)
|
||||
{
|
||||
var videoInfo = GetVideoInfo(args);
|
||||
if (videoInfo == null)
|
||||
{
|
||||
args.FailureReason = "Failed to retrieve video info";
|
||||
args.Logger?.ELog(args.FailureReason);
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool alreadyProcessed = videoInfo.AlreadyProcessed;
|
||||
if (alreadyProcessed)
|
||||
{
|
||||
args.Logger?.ILog("Video has already been processed by FileFlows");
|
||||
return 1;
|
||||
}
|
||||
|
||||
args.Logger?.ILog("Video has not been processed by FileFlows");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,11 @@ public class VideoInfo
|
||||
/// </summary>
|
||||
public float Bitrate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if this file is already processed
|
||||
/// </summary>
|
||||
public bool AlreadyProcessed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the video streams contained in the file
|
||||
/// </summary>
|
||||
|
||||
@@ -107,6 +107,7 @@ public class VideoInfoHelper
|
||||
public static VideoInfo ParseOutput(ILogger logger, string output)
|
||||
{
|
||||
var vi = new VideoInfo();
|
||||
vi.AlreadyProcessed = output.Contains("Created by FileFlows");
|
||||
var rgxStreams = new Regex(@"Stream\s#[\d]+:[\d]+(.*?)(?=(Stream\s#[\d]|$))", RegexOptions.Singleline);
|
||||
var streamMatches = rgxStreams.Matches(output);
|
||||
int streamIndex = 0;
|
||||
|
||||
@@ -799,6 +799,14 @@
|
||||
"2": "Video is not 12-Bit"
|
||||
}
|
||||
},
|
||||
"VideoAlreadyProcessed": {
|
||||
"Label": "Video Already Processed",
|
||||
"Description": "Test if a video file has already been processed bv FileFlows",
|
||||
"Outputs": {
|
||||
"1": "Video has already been processed",
|
||||
"2": "Video has not been processed"
|
||||
}
|
||||
},
|
||||
"VideoIsInterlaced": {
|
||||
"Label": "Video Is Interlaced",
|
||||
"Description": "Tests if a video file is interlaced",
|
||||
|
||||
Reference in New Issue
Block a user