FF-1602: Added bitrate per channel to add audio track

This commit is contained in:
John Andrews
2024-06-11 08:57:59 +12:00
parent e01deb3a78
commit 8f113ff501
16 changed files with 138 additions and 61 deletions

View File

@@ -1,43 +1,56 @@
namespace FileFlows.BasicNodes.File
using FileFlows.Plugin;
using FileFlows.Plugin.Attributes;
namespace FileFlows.BasicNodes.File;
/// <summary>
/// Flow element that compares a file size
/// </summary>
public class FileSize : Node
{
using System.ComponentModel;
using FileFlows.Plugin;
using FileFlows.Plugin.Attributes;
/// <inheritdoc />
public override int Inputs => 1;
/// <inheritdoc />
public override int Outputs => 2;
/// <inheritdoc />
public override FlowElementType Type => FlowElementType.Logic;
/// <inheritdoc />
public override string Icon => "fas fa-balance-scale-right";
/// <inheritdoc />
public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/file-size";
public class FileSize : Node
/// <summary>
/// Gets or sets the lower value
/// </summary>
[NumberInt(1)]
public int Lower { get; set; }
/// <summary>
/// Gets or sets the upper value
/// </summary>
[NumberInt(2)]
public int Upper { get; set; }
/// <inheritdoc />
public override int Execute(NodeParameters args)
{
public override int Inputs => 1;
public override int Outputs => 2;
public override FlowElementType Type => FlowElementType.Logic;
public override string Icon => "fas fa-balance-scale-right";
public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/file-size";
[NumberInt(1)]
public int Lower { get; set; }
[NumberInt(2)]
public int Upper { get; set; }
public override int Execute(NodeParameters args)
var result = args.IsDirectory ? args.FileService.DirectorySize(args.WorkingFile) : args.FileService.FileSize(args.WorkingFile);
if(result.Failed(out string error))
{
var result = args.FileService.FileSize(args.WorkingFile);
if(result.IsFailed)
{
args.Logger.ELog("File Does not exist: " + args.WorkingFile);
return -1;
}
return TestSize(args, result.ValueOrDefault);
args.Logger.ELog("Error getting size: " + error);
return -1;
}
public int TestSize(NodeParameters args, long size)
{
if (size < (((long)Lower) * 1024 * 1024))
return 2;
if (Upper > 0 && size > (((long)Upper) * 1024 * 1024))
return 2;
return 1;
}
return TestSize(args, result.ValueOrDefault);
}
public int TestSize(NodeParameters args, long size)
{
if (size < (((long)Lower) * 1024 * 1024))
return 2;
if (Upper > 0 && size > (((long)Upper) * 1024 * 1024))
return 2;
return 1;
}
}

View File

@@ -365,6 +365,11 @@ public class LocalFileService : IFileService
}
}
public Result<long> DirectorySize(string path)
{
throw new NotImplementedException();
}
public Result<bool> SetCreationTimeUtc(string path, DateTime date)
{
if (IsProtectedPath(ref path))

View File

@@ -105,6 +105,11 @@ public class TestFileService : IFileService
throw new NotImplementedException();
}
public Result<long> DirectorySize(string path)
{
throw new NotImplementedException();
}
public Result<bool> SetCreationTimeUtc(string path, DateTime date)
{
throw new NotImplementedException();