diff --git a/Apprise/Plugin.cs b/Apprise/Plugin.cs index 0b401799..ea5fb0ae 100644 --- a/Apprise/Plugin.cs +++ b/Apprise/Plugin.cs @@ -1,11 +1,20 @@ namespace FileFlows.Apprise; +/// +/// Apprise Plugin +/// public class Plugin : FileFlows.Plugin.IPlugin { + /// public Guid Uid => new Guid("32d0e2ad-7617-4b52-bc39-338d2cfe468c"); + /// public string Name => "Apprise Nodes"; + /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:apprise"; + /// public void Init() { } diff --git a/AudioNodes/AudioBooks/CreateAudioBook.cs b/AudioNodes/AudioBooks/CreateAudioBook.cs index f73382e1..be4f2537 100644 --- a/AudioNodes/AudioBooks/CreateAudioBook.cs +++ b/AudioNodes/AudioBooks/CreateAudioBook.cs @@ -1,6 +1,3 @@ -using FileFlows.Plugin; -using TagLib.Tiff.Cr2; - namespace FileFlows.AudioNodes; /// @@ -84,6 +81,7 @@ public class CreateAudioBook: AudioNode string extension = FileHelper.GetExtension(file); if (allowedExtensions.Contains(extension.ToLower()) == false) continue; + args.Logger?.ILog("Found audio file: " + file); files.Add(file); } @@ -109,19 +107,19 @@ public class CreateAudioBook: AudioNode var matches = rgxNumbers.Matches(shortname); if (matches.Any() == false) { - args.Logger.DLog("No number found in: " + shortname); + args.Logger.ILog("No number found in: " + shortname); return 100000; } if (matches.Count == 1) { - args.Logger.DLog($"Number [{matches[0].Value}] found in: " + shortname); + args.Logger.ILog($"Number [{matches[0].Value}] found in: " + shortname); return int.Parse(matches[0].Value); } // we may have a year, if first number is 4 digits, assume year var number = matches[0].Length == 4 ? int.Parse(matches[1].Value) : int.Parse(matches[0].Value); - args.Logger.DLog($"Number [{number}] found in: " + shortname); + args.Logger.ILog($"Number [{number}] found in: " + shortname); return number; }).ToList(); @@ -129,8 +127,8 @@ public class CreateAudioBook: AudioNode TimeSpan current = TimeSpan.Zero; string bookName = FileHelper.GetShortFileName(dir); int chapterCount = 1; - - System.IO.File.WriteAllText(metadataFile, @";FFMETADATA1\n\n" + string.Join("\n", files.Select(x => + + string metadataContents = @";FFMETADATA1\n\n" + string.Join("\n", files.Select(x => { string extension = FileHelper.GetExtension(x); string name = FileHelper.GetShortFileName(x); @@ -145,9 +143,13 @@ public class CreateAudioBook: AudioNode current = end; ++chapterCount; return chapter; - }))); + })); + args.Logger?.ILog("Metadata Content:\n" + metadataContents); + System.IO.File.WriteAllText(metadataFile, metadataContents); string inputFiles = FileHelper.Combine(args.TempPath, Guid.NewGuid() + ".txt"); - System.IO.File.WriteAllText(inputFiles, string.Join("\n", files.Select(x => $"file '{x}'"))); + string strInputFiles = string.Join("\n", files.Select(x => $"file '{x}'")); + System.IO.File.WriteAllText(inputFiles, strInputFiles); + args.Logger?.ILog("Input Files:\n" + inputFiles); string outputFile = FileHelper.Combine(args.TempPath, Guid.NewGuid() + ".m4b"); diff --git a/AudioNodes/InputNodes/AudioFile.cs b/AudioNodes/InputNodes/AudioFile.cs index 68435be1..2bdd349a 100644 --- a/AudioNodes/InputNodes/AudioFile.cs +++ b/AudioNodes/InputNodes/AudioFile.cs @@ -68,26 +68,27 @@ namespace FileFlows.AudioNodes { if (ReadAudioFileInfo(args, ffmpegExe, ffprobe, LocalWorkingFile)) return 1; + return -1; - var AudioInfo = GetAudioInfo(args); - if (AudioInfo.Failed(out string error)) - { - args.FailureReason = error; - args.Logger?.ELog(error); - return -1; - } - - if (string.IsNullOrEmpty(AudioInfo.Value.Codec) == false) - args.RecordStatistic("CODEC", AudioInfo.Value.Codec); - - string container = FileHelper.GetExtension(args.FileName).ToUpperInvariant().TrimStart('.'); - if (string.IsNullOrEmpty(container) == false) - { - args.Logger?.ILog("Audio Container: " + container); - args.RecordStatistic("AUDIO_CONTAINER", container); - } - - return 0; + // var AudioInfo = GetAudioInfo(args); + // if (AudioInfo.Failed(out string error)) + // { + // args.FailureReason = error; + // args.Logger?.ELog(error); + // return -1; + // } + // + // if (string.IsNullOrEmpty(AudioInfo.Value.Codec) == false) + // args.RecordStatistic("CODEC", AudioInfo.Value.Codec); + // + // string container = FileHelper.GetExtension(args.FileName).ToUpperInvariant().TrimStart('.'); + // if (string.IsNullOrEmpty(container) == false) + // { + // args.Logger?.ILog("Audio Container: " + container); + // args.RecordStatistic("AUDIO_CONTAINER", container); + // } + // + // return 0; } catch (Exception ex) { diff --git a/AudioNodes/Nodes/ConvertFlowElements/ConvertAudio.cs b/AudioNodes/Nodes/ConvertFlowElements/ConvertAudio.cs new file mode 100644 index 00000000..537da94a --- /dev/null +++ b/AudioNodes/Nodes/ConvertFlowElements/ConvertAudio.cs @@ -0,0 +1,59 @@ +namespace FileFlows.AudioNodes; + +public class ConvertAudio : ConvertNode +{ + protected override string Extension => Codec; + public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-audio"; + + public static List BitrateOptions => ConvertNode.BitrateOptions; + + [Select(nameof(CodecOptions), 0)] + public string Codec { get; set; } + + /// + /// Gets or sets if high efficiency should be used + /// + [Boolean(5)] + [ConditionEquals(nameof(Codec), "aac")] + public bool HighEfficiency { get => base.HighEfficiency; set =>base.HighEfficiency = value; } + + private static List _CodecOptions; + public static List CodecOptions + { + get + { + if (_CodecOptions == null) + { + _CodecOptions = new List + { + new () { Label = "AAC", Value = "aac"}, + new () { Label = "MP3", Value = "MP3"}, + new () { Label = "OGG (Vorbis)", Value = "ogg"}, + new () { Label = "OGG (Opus)", Value = "libopus"}, + new () { Label = "WAV", Value = "wav"}, + }; + } + return _CodecOptions; + } + } + + public override int Execute(NodeParameters args) + { + var audioInfoResult = GetAudioInfo(args); + if (audioInfoResult.Failed(out string error)) + { + args.Logger?.ELog(error); + args.FailureReason = error; + return -1; + } + + AudioInfo AudioInfo = audioInfoResult.Value; + + string ffmpegExe = GetFFmpeg(args); + if (string.IsNullOrEmpty(ffmpegExe)) + return -1; + + return base.Execute(args); + + } +} diff --git a/AudioNodes/Nodes/ConvertNode.cs b/AudioNodes/Nodes/ConvertFlowElements/ConvertNode.cs similarity index 57% rename from AudioNodes/Nodes/ConvertNode.cs rename to AudioNodes/Nodes/ConvertFlowElements/ConvertNode.cs index 09df8315..ac138042 100644 --- a/AudioNodes/Nodes/ConvertNode.cs +++ b/AudioNodes/Nodes/ConvertFlowElements/ConvertNode.cs @@ -2,136 +2,7 @@ namespace FileFlows.AudioNodes { - public class ConvertToMP3 : ConvertNode - { - /// - public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-to-mp3"; - /// - protected override string Extension => "mp3"; - /// - public override string Icon => "svg:mp3"; - } - public class ConvertToWAV : ConvertNode - { - /// - public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-to-wav"; - /// - protected override string Extension => "wav"; - /// - public override string Icon => "svg:wav"; - - private static List _BitrateOptions; - public new static List BitrateOptions - { - get - { - if (_BitrateOptions == null) - { - _BitrateOptions = new List - { - new () { Label = "Automatic", Value = 0 }, - new () { Label = "Same as source", Value = -1 }, - new () { Label = "64 Kbps", Value = 64}, - new () { Label = "96 Kbps", Value = 96}, - new () { Label = "128 Kbps", Value = 128}, - new () { Label = "160 Kbps", Value = 160}, - new () { Label = "192 Kbps", Value = 192}, - new () { Label = "224 Kbps", Value = 224}, - new () { Label = "256 Kbps", Value = 256}, - new () { Label = "288 Kbps", Value = 288}, - new () { Label = "320 Kbps", Value = 320}, - }; - } - return _BitrateOptions; - } - } - } - - public class ConvertToAAC : ConvertNode - { - /// - public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-to-aac"; - /// - protected override string Extension => "aac"; - /// - public override string Icon => "svg:aac"; - - /// - /// Gets or sets if high efficiency should be used - /// - [Boolean(5)] - public bool HighEfficiency { get => base.HighEfficiency; set =>base.HighEfficiency = value; } - - protected override bool SetId3Tags => true; - } - public class ConvertToOGG: ConvertNode - { - /// - public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-to-ogg"; - /// - protected override string Extension => "ogg"; - public static List BitrateOptions => ConvertNode.BitrateOptions; - /// - public override string Icon => "svg:ogg"; - } - - public class ConvertAudio : ConvertNode - { - protected override string Extension => Codec; - public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-audio"; - - public static List BitrateOptions => ConvertNode.BitrateOptions; - - [Select(nameof(CodecOptions), 0)] - public string Codec { get; set; } - - /// - /// Gets or sets if high efficiency should be used - /// - [Boolean(5)] - [ConditionEquals(nameof(Codec), "aac")] - public bool HighEfficiency { get => base.HighEfficiency; set =>base.HighEfficiency = value; } - - private static List _CodecOptions; - public static List CodecOptions - { - get - { - if (_CodecOptions == null) - { - _CodecOptions = new List - { - new () { Label = "AAC", Value = "aac"}, - new () { Label = "MP3", Value = "MP3"}, - new () { Label = "OGG", Value = "ogg"}, - new () { Label = "WAV", Value = "wav"}, - }; - } - return _CodecOptions; - } - } - - public override int Execute(NodeParameters args) - { - var audioInfoResult = GetAudioInfo(args); - if (audioInfoResult.Failed(out string error)) - { - args.Logger?.ELog(error); - args.FailureReason = error; - return -1; - } - - AudioInfo AudioInfo = audioInfoResult.Value; - - string ffmpegExe = GetFFmpeg(args); - if (string.IsNullOrEmpty(ffmpegExe)) - return -1; - - return base.Execute(args); - - } - } public abstract class ConvertNode:AudioNode { @@ -157,15 +28,19 @@ namespace FileFlows.AudioNodes string Codec = Extension; extension = null; string codecKey = Codec + "_codec"; - string codec = args.GetToolPathActual(codecKey); + string codec = args.GetToolPathActual(codecKey)?.EmptyAsNull() ?? Codec; if (codec == "mp3") extension = "mp3"; - if (codec == "libvorbis" || codec == "ogg") + else if (codec == "libopus") + extension = "ogg"; + else if (codec == "libvorbis" || codec == "ogg") { codec = "libvorbis"; extension = "ogg"; } + bool ogg = extension?.ToLowerInvariant() == "ogg"; + if (codec == codecKey || string.IsNullOrWhiteSpace(codec)) { codec = Codec switch @@ -177,7 +52,7 @@ namespace FileFlows.AudioNodes } int bitrate = Bitrate; - if (Codec.ToLowerInvariant() == "mp3" || Codec.ToLowerInvariant() == "ogg" || Codec.ToLowerInvariant() == "aac") + if (Codec.ToLowerInvariant() == "mp3" || ogg || Codec.ToLowerInvariant() == "aac") { if (bitrate is >= 10 and <= 20) { @@ -361,14 +236,6 @@ namespace FileFlows.AudioNodes return 2; } } - //AudioInfo AudioInfo = GetAudioInfo(args); - //if (AudioInfo == null) - // return -1; - // if (Bitrate != 0 && Bitrate != -1 && (Bitrate < 64 || Bitrate > 320)) - // { - // args.Logger?.ILog("Bitrate not set or invalid, setting to 192kbps"); - // Bitrate = 192; - // } var ffArgs = GetArguments(args, out string extension); @@ -420,48 +287,5 @@ namespace FileFlows.AudioNodes return -1; } - - //private void CopyMetaData(string outputFile, string originalFile) - //{ - // Track original = new Track(originalFile); - // Track dest = new Track(outputFile); - - // dest.Album = original.Album; - // dest.AlbumArtist = original.AlbumArtist; - // dest.Artist = original.Artist; - // dest.Comment = original.Comment; - // dest.Composer= original.Composer; - // dest.Conductor = original.Conductor; - // dest.Copyright = original.Copyright; - // dest.Date = original.Date; - // dest.Description= original.Description; - // dest.DiscNumber= original.DiscNumber; - // dest.DiscTotal = original.DiscTotal; - // if (original.EmbeddedPictures?.Any() == true) - // { - // foreach (var pic in original.EmbeddedPictures) - // dest.EmbeddedPictures.Add(pic); - // } - // dest.Genre= original.Genre; - // dest.Lyrics= original.Lyrics; - // dest.OriginalAlbum= original.OriginalAlbum; - // dest.OriginalArtist = original.OriginalArtist; - // dest.Popularity= original.Popularity; - // dest.Publisher= original.Publisher; - // dest.PublishingDate= original.PublishingDate; - // dest.Title= original.Title; - // dest.TrackNumber= original.TrackNumber; - // dest.TrackTotal= original.TrackTotal; - // dest.Year= original.Year; - // foreach (var key in original.AdditionalFields.Keys) - // { - // if(dest.AdditionalFields.ContainsKey(key)) - // dest.AdditionalFields[key] = original.AdditionalFields[key]; - // else - // dest.AdditionalFields.Add(key, original.AdditionalFields[key]); - // } - - // dest.Save(); - //} } } diff --git a/AudioNodes/Nodes/ConvertFlowElements/ConvertToAAC.cs b/AudioNodes/Nodes/ConvertFlowElements/ConvertToAAC.cs new file mode 100644 index 00000000..e03ddb6f --- /dev/null +++ b/AudioNodes/Nodes/ConvertFlowElements/ConvertToAAC.cs @@ -0,0 +1,19 @@ +namespace FileFlows.AudioNodes; + +public class ConvertToAAC : ConvertNode +{ + /// + public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-to-aac"; + /// + protected override string Extension => "aac"; + /// + public override string Icon => "svg:aac"; + + /// + /// Gets or sets if high efficiency should be used + /// + [Boolean(5)] + public bool HighEfficiency { get => base.HighEfficiency; set =>base.HighEfficiency = value; } + + protected override bool SetId3Tags => true; +} \ No newline at end of file diff --git a/AudioNodes/Nodes/ConvertFlowElements/ConvertToMP3.cs b/AudioNodes/Nodes/ConvertFlowElements/ConvertToMP3.cs new file mode 100644 index 00000000..f4e54440 --- /dev/null +++ b/AudioNodes/Nodes/ConvertFlowElements/ConvertToMP3.cs @@ -0,0 +1,12 @@ +namespace FileFlows.AudioNodes; + +public class ConvertToMP3 : ConvertNode +{ + /// + public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-to-mp3"; + /// + protected override string Extension => "mp3"; + + /// + public override string Icon => "svg:mp3"; +} \ No newline at end of file diff --git a/AudioNodes/Nodes/ConvertFlowElements/ConvertToOGG.cs b/AudioNodes/Nodes/ConvertFlowElements/ConvertToOGG.cs new file mode 100644 index 00000000..f6f12b4c --- /dev/null +++ b/AudioNodes/Nodes/ConvertFlowElements/ConvertToOGG.cs @@ -0,0 +1,66 @@ +namespace FileFlows.AudioNodes; + + public class ConvertToOGG: ConvertNode + { + /// + public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-to-ogg"; + + /// + protected override string Extension => "ogg"; + + public static List BitrateOptions => ConvertNode.BitrateOptions; + + /// + public override string Icon => "svg:ogg"; + + /// + /// Gets or sets the codec + /// + [Select(nameof(CodecOptions), 0)] + public string Codec { get; set; } + + /// + /// The codec options + /// + private static List _CodecOptions; + /// + /// Gets the codec options + /// + public static List CodecOptions + { + get + { + if (_CodecOptions == null) + { + _CodecOptions = new() + { + new() { Label = "Vorbis",Value = "vorbis" }, + new() { Label = "Opus", Value = "opus" } + }; + } + + return _CodecOptions; + } + } + + /// + protected override List GetArguments(NodeParameters args, out string? extension) + { + List ffArgs = base.GetArguments(args, out extension); + if (string.Equals(this.Codec, "opus", StringComparison.InvariantCultureIgnoreCase)) + { + var index = ffArgs.FindIndex(arg => arg.Equals("libvorbis")); + if (index != -1) + { + ffArgs[index] = "libopus"; + args.Logger?.ILog("Replace 'libopus' with 'libvorbis'"); + } + else + { + args.Logger?.ILog("Failed to locate libopus in arguments"); + } + } + + return ffArgs; + } + } \ No newline at end of file diff --git a/AudioNodes/Nodes/ConvertFlowElements/ConvertToWAV.cs b/AudioNodes/Nodes/ConvertFlowElements/ConvertToWAV.cs new file mode 100644 index 00000000..d36519c0 --- /dev/null +++ b/AudioNodes/Nodes/ConvertFlowElements/ConvertToWAV.cs @@ -0,0 +1,37 @@ +namespace FileFlows.AudioNodes; + +public class ConvertToWAV : ConvertNode +{ + /// + public override string HelpUrl => "https://fileflows.com/docs/plugins/audio-nodes/convert-to-wav"; + /// + protected override string Extension => "wav"; + /// + public override string Icon => "svg:wav"; + + private static List _BitrateOptions; + public new static List BitrateOptions + { + get + { + if (_BitrateOptions == null) + { + _BitrateOptions = new List + { + new () { Label = "Automatic", Value = 0 }, + new () { Label = "Same as source", Value = -1 }, + new () { Label = "64 Kbps", Value = 64}, + new () { Label = "96 Kbps", Value = 96}, + new () { Label = "128 Kbps", Value = 128}, + new () { Label = "160 Kbps", Value = 160}, + new () { Label = "192 Kbps", Value = 192}, + new () { Label = "224 Kbps", Value = 224}, + new () { Label = "256 Kbps", Value = 256}, + new () { Label = "288 Kbps", Value = 288}, + new () { Label = "320 Kbps", Value = 320}, + }; + } + return _BitrateOptions; + } + } +} \ No newline at end of file diff --git a/AudioNodes/Plugin.cs b/AudioNodes/Plugin.cs index c220f444..8a7fd108 100644 --- a/AudioNodes/Plugin.cs +++ b/AudioNodes/Plugin.cs @@ -5,10 +5,15 @@ using FileFlows.Plugin.Attributes; public class Plugin : FileFlows.Plugin.IPlugin { + /// public Guid Uid => new Guid("d951a39e-4296-4801-ab41-4070b0789465"); public string Name => "Audio Nodes"; + /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:audio"; + /// public void Init() { } diff --git a/AudioNodes/Tests/ConvertTests.cs b/AudioNodes/Tests/ConvertTests.cs index 408b5f61..5094083d 100644 --- a/AudioNodes/Tests/ConvertTests.cs +++ b/AudioNodes/Tests/ConvertTests.cs @@ -9,6 +9,14 @@ namespace FileFlows.AudioNodes.Tests; [TestClass] public class ConvertTests { + private TestContext testContextInstance; + + public TestContext TestContext + { + get { return testContextInstance; } + set { testContextInstance = value; } + } + [TestMethod] public void Convert_FlacToAac() { @@ -81,15 +89,32 @@ public class ConvertTests public void Convert_Mp3ToOgg() { - const string file = @"D:\music\unprocessed\04-billy_joel-scenes_from_an_italian_restaurant-b2125758.mp3"; + const string file = @"/home/john/Music/unprocessed/The Cranberries - No Need to Argue (1994) - 04 - Zombie.mp3"; - ConvertToOGG node = new(); - var args = new FileFlows.Plugin.NodeParameters(file, new TestLogger(), false, string.Empty, null);; - args.GetToolPathActual = (string tool) => @"C:\utils\ffmpeg\ffmpeg.exe"; - args.TempPath = @"D:\music\temp"; - new AudioFile().Execute(args); // need to read the Audio info and set it - int output = node.Execute(args); + //ConvertToOGG node = new(); + var logger = new TestLogger(); + var args = new FileFlows.Plugin.NodeParameters(file, logger, false, string.Empty, new LocalFileService());; + args.GetToolPathActual = (string tool) => + { + if(tool.ToLowerInvariant() == "ffprobe") + return @"/usr/local/bin/ffprobe"; + if(tool.ToLowerInvariant() == "ffmpeg") + return @"/usr/local/bin/ffmpeg"; + return string.Empty; + }; + args.TempPath = @"/home/john/Music/temp"; + var af = new AudioFile(); + af.PreExecute(args); + af.Execute(args); // need to read the Audio info and set it + //int output = node.Execute(args); + var ele = new ConvertAudio(); + ele.Codec = "libopus"; + ele.Bitrate = 320; + ele.PreExecute(args); + int output = ele.Execute(args); + + TestContext.WriteLine(logger.ToString()); Assert.AreEqual(1, output); } @@ -198,9 +223,11 @@ public class ConvertTests args.TempPath = @"D:\music\temp"; new AudioFile().Execute(args); // need to read the Audio info and set it node.Normalize = true; + node.PreExecute(args); int output = node.Execute(args); string log = logger.ToString(); + TestContext.WriteLine(log); Assert.AreEqual(1, output); } diff --git a/BasicNodes/File/PatternReplacer.cs b/BasicNodes/File/PatternReplacer.cs index 6f4c2d0f..1016140d 100644 --- a/BasicNodes/File/PatternReplacer.cs +++ b/BasicNodes/File/PatternReplacer.cs @@ -1,32 +1,46 @@ using FileFlows.Plugin.Helpers; - -namespace FileFlows.BasicNodes.Functions; - using System.ComponentModel.DataAnnotations; using System.Text.RegularExpressions; using FileFlows.Plugin; using FileFlows.Plugin.Attributes; +namespace FileFlows.BasicNodes.Functions; + +/// +/// Replaces matching patterns in a fil +/// public class PatternReplacer : Node { + /// public override int Inputs => 1; + /// public override int Outputs => 2; + /// public override FlowElementType Type => FlowElementType.Process; + /// public override string Icon => "fas fa-exchange-alt"; public string Group => "File"; + /// public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/filename-pattern-replacer"; internal bool UnitTest = false; + /// + /// Gets or sets replacements to replace + /// [KeyValue(1, null)] [Required] public List> Replacements{ get; set; } + /// + /// Gets or sets if the working file should be used + /// [Boolean(2)] public bool UseWorkingFileName { get; set; } + /// public override int Execute(NodeParameters args) { if (Replacements?.Any() != true) @@ -34,7 +48,6 @@ public class PatternReplacer : Node try { - //string filename = new FileInfo(UseWorkingFileName ? args.WorkingFile : args.FileName).Name; string filename = FileHelper.GetShortFileName(UseWorkingFileName ? args.WorkingFile : args.FileName); string updated = RunReplacements(args, filename); @@ -47,7 +60,7 @@ public class PatternReplacer : Node args.Logger?.ILog($"Pattern replacement: '{filename}' to '{updated}'"); string directory = FileHelper.GetDirectory(args.WorkingFile); - string dest = directory + args.FileService.PathSeparator + updated; + string dest = FileHelper.Combine(directory, updated); args.Logger?.ILog($"New filename: " + dest); if (UnitTest == false) { diff --git a/BasicNodes/Plugin.cs b/BasicNodes/Plugin.cs index 6eb25159..86d052c1 100644 --- a/BasicNodes/Plugin.cs +++ b/BasicNodes/Plugin.cs @@ -4,10 +4,17 @@ namespace FileFlows.BasicNodes public class Plugin : FileFlows.Plugin.IPlugin { + /// public Guid Uid => new Guid("789b5213-4ca5-42da-816e-f2117f00cd16"); + /// public string Name => "Basic Nodes"; + /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:basic"; + + /// public void Init() { } } } diff --git a/ChecksumNodes/Plugin.cs b/ChecksumNodes/Plugin.cs index 24b1bcb9..532a3a18 100644 --- a/ChecksumNodes/Plugin.cs +++ b/ChecksumNodes/Plugin.cs @@ -2,10 +2,16 @@ namespace ChecksumNodes; public class Plugin : IPlugin { + /// public Guid Uid => new Guid("5ce1524c-5e7b-40ee-9fc1-2152181490f1"); + /// public string Name => "Checksum Nodes"; + /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "fas fa-file-contract"; + /// public void Init() { } diff --git a/ComicNodes/Comics/ComicConverter.cs b/ComicNodes/Comics/ComicConverter.cs index 49d9eae2..855d9706 100644 --- a/ComicNodes/Comics/ComicConverter.cs +++ b/ComicNodes/Comics/ComicConverter.cs @@ -53,8 +53,8 @@ public class ComicConverter: Node int pageCount = GetPageCount(args, currentFormat, args.WorkingFile); metadata.Add("Format", currentFormat); metadata.Add("Pages", pageCount); - args.RecordStatistic("COMIC_FORMAT", currentFormat); - args.RecordStatistic("COMIC_PAGES", pageCount); + args.RecordStatisticRunningTotals("COMIC_FORMAT", currentFormat); + args.RecordStatisticAverage("COMIC_PAGES", pageCount); args.SetMetadata(metadata); args.Logger?.ILog("Setting metadata: " + currentFormat); diff --git a/ComicNodes/Plugin.cs b/ComicNodes/Plugin.cs index 72751ece..1968a173 100644 --- a/ComicNodes/Plugin.cs +++ b/ComicNodes/Plugin.cs @@ -2,10 +2,16 @@ namespace FileFlows.Comic; public class Plugin : FileFlows.Plugin.IPlugin { + /// public Guid Uid => new Guid("3664da0a-b531-47b9-bdc8-e8368d9746ce"); + /// public string Name => "Comic Nodes"; + /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:comic"; + /// public void Init() { } diff --git a/DiscordNodes/Plugin.cs b/DiscordNodes/Plugin.cs index df940bf2..ba5aa489 100644 --- a/DiscordNodes/Plugin.cs +++ b/DiscordNodes/Plugin.cs @@ -18,6 +18,9 @@ public class Plugin : FileFlows.Plugin.IPlugin /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "fab fa-discord:#5865F2"; + /// /// Initializes this plugin /// diff --git a/EmailNodes/Plugin.cs b/EmailNodes/Plugin.cs index 4624d65c..a90f7964 100644 --- a/EmailNodes/Plugin.cs +++ b/EmailNodes/Plugin.cs @@ -2,10 +2,16 @@ namespace FileFlows.EmailNodes; public class Plugin : IPlugin { + /// public Guid Uid => new Guid("b5077522-4a31-4faa-b9a7-b409ecb9c01e"); + /// public string Name => "Email"; + /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "fas fa-envelope"; + /// public void Init() { } diff --git a/Emby/Plugin.cs b/Emby/Plugin.cs index 43ec23d9..7d672c8d 100644 --- a/Emby/Plugin.cs +++ b/Emby/Plugin.cs @@ -2,10 +2,16 @@ namespace FileFlows.Emby; public class Plugin : FileFlows.Plugin.IPlugin { + /// public Guid Uid => new Guid("51bdd442-6630-4c8c-b3a4-70a2d1c60309"); + /// public string Name => "Emby"; + /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:emby"; + /// public void Init() { } diff --git a/FileFlows.Plugin.dll b/FileFlows.Plugin.dll index 869d3456..b2f7bf07 100644 Binary files a/FileFlows.Plugin.dll and b/FileFlows.Plugin.dll differ diff --git a/FileFlows.Plugin.pdb b/FileFlows.Plugin.pdb index 9c8e26f1..6b1534f1 100644 Binary files a/FileFlows.Plugin.pdb and b/FileFlows.Plugin.pdb differ diff --git a/Gotify/Plugin.cs b/Gotify/Plugin.cs index c35d2be3..c5ccd37c 100644 --- a/Gotify/Plugin.cs +++ b/Gotify/Plugin.cs @@ -19,6 +19,8 @@ public class Plugin : FileFlows.Plugin.IPlugin /// Gets the minimum version of FileFlows required for this plugin /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:gotify"; /// /// Initializes this plugin diff --git a/ImageNodes/Images/ImageFile.cs b/ImageNodes/Images/ImageFile.cs index a1b7f811..27c2274b 100644 --- a/ImageNodes/Images/ImageFile.cs +++ b/ImageNodes/Images/ImageFile.cs @@ -39,7 +39,7 @@ public class ImageFile : ImageBaseNode UpdateImageInfo(args, this.Variables); if(string.IsNullOrEmpty(base.CurrentFormat) == false) - args.RecordStatistic("IMAGE_FORMAT", base.CurrentFormat); + args.RecordStatisticRunningTotals("IMAGE_FORMAT", base.CurrentFormat); return 1; } diff --git a/ImageNodes/Plugin.cs b/ImageNodes/Plugin.cs index de92ca0d..7666b979 100644 --- a/ImageNodes/Plugin.cs +++ b/ImageNodes/Plugin.cs @@ -2,10 +2,16 @@ namespace FileFlows.ImageNodes; public class Plugin : FileFlows.Plugin.IPlugin { + /// public Guid Uid => new Guid("a6ddeee5-4c5a-46c5-80d5-e48552dd6a9b"); + /// public string Name => "Image Nodes"; + /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:image"; + /// public void Init() { } diff --git a/MetaNodes/Plugin.cs b/MetaNodes/Plugin.cs index 449102de..2d7999bb 100644 --- a/MetaNodes/Plugin.cs +++ b/MetaNodes/Plugin.cs @@ -4,9 +4,15 @@ using System.ComponentModel.DataAnnotations; public class Plugin : FileFlows.Plugin.IPlugin { + /// public Guid Uid => new Guid("ed1e2547-6f92-4bc8-ae49-fcd7c74e7e9c"); + /// public string Name => "Meta Nodes"; + /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:database"; + /// public void Init() { } } diff --git a/Plex/Plugin.cs b/Plex/Plugin.cs index ffe57019..d70d55c9 100644 --- a/Plex/Plugin.cs +++ b/Plex/Plugin.cs @@ -2,10 +2,16 @@ namespace FileFlows.Plex; public class Plugin : FileFlows.Plugin.IPlugin { + /// public Guid Uid => new Guid("5be72267-7574-4ba9-a958-f3dda0d6c2dc"); + /// public string Name => "Plex"; + /// public string MinimumVersion => "1.0.4.2019"; - + /// + public string Icon => "svg:plex"; + + /// public void Init() { } diff --git a/Pushbullet/Plugin.cs b/Pushbullet/Plugin.cs index cc5fcc78..c67aec42 100644 --- a/Pushbullet/Plugin.cs +++ b/Pushbullet/Plugin.cs @@ -19,6 +19,8 @@ public class Plugin : FileFlows.Plugin.IPlugin /// Gets the minimum version of FileFlows required for this plugin /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:pushbullet"; /// /// Initializes this plugin diff --git a/Pushover/Plugin.cs b/Pushover/Plugin.cs index c84a5d82..f49d7be7 100644 --- a/Pushover/Plugin.cs +++ b/Pushover/Plugin.cs @@ -19,6 +19,8 @@ public class Plugin : FileFlows.Plugin.IPlugin /// Gets the minimum version of FileFlows required for this plugin /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:pushover"; /// /// Initializes this plugin diff --git a/Telegram/Plugin.cs b/Telegram/Plugin.cs index 355f9264..e83f9db2 100644 --- a/Telegram/Plugin.cs +++ b/Telegram/Plugin.cs @@ -20,6 +20,9 @@ public class Plugin : FileFlows.Plugin.IPlugin /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "fab fa-telegram-plane"; + /// /// Initializes this plugin /// diff --git a/VideoNodes/FFMpegEncoder.cs b/VideoNodes/FFMpegEncoder.cs index 0bab2440..002e7006 100644 --- a/VideoNodes/FFMpegEncoder.cs +++ b/VideoNodes/FFMpegEncoder.cs @@ -17,7 +17,7 @@ public class FFMpegEncoder public delegate void TimeEvent(TimeSpan time, DateTime startedAt); public event TimeEvent AtTime; - public delegate void StatChange(string name, object value, bool recordStatistic = false); + public delegate void StatChange(string name, string value, bool recordStatistic = false); public event StatChange OnStatChange; private Process process; diff --git a/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderExecutor.cs b/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderExecutor.cs index 844c134a..8f4e7f03 100644 --- a/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderExecutor.cs +++ b/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderExecutor.cs @@ -236,7 +236,7 @@ public class FfmpegBuilderExecutor: FfmpegBuilderNode GetHardwareDecodingArgs(args, localFile, FFMPEG, video?.Stream?.Codec, pxtFormat, encodingParameters: encodingParameters); if (decodingParameters.Any() == true) { - args.StatisticRecorder("DecoderParameters", string.Join(" ", decodingParameters)); + args.StatisticRecorderRunningTotals("DecoderParameters", string.Join(" ", decodingParameters)); startArgs.AddRange(decodingParameters); } } diff --git a/VideoNodes/InputNodes/VideoFile.cs b/VideoNodes/InputNodes/VideoFile.cs index 00fb4e91..cd67d51c 100644 --- a/VideoNodes/InputNodes/VideoFile.cs +++ b/VideoNodes/InputNodes/VideoFile.cs @@ -94,8 +94,8 @@ public class VideoFile : VideoNode { if (string.IsNullOrEmpty(stream.Codec) == false) { - args.RecordStatistic("CODEC", stream.Codec); - args.RecordStatistic("VIDEO_CODEC", stream.Codec); + args.RecordStatisticRunningTotals("CODEC", stream.Codec); + args.RecordStatisticRunningTotals("VIDEO_CODEC", stream.Codec); } } @@ -103,8 +103,8 @@ public class VideoFile : VideoNode { if (string.IsNullOrEmpty(stream.Codec) == false) { - args.RecordStatistic("CODEC", stream.Codec); - args.RecordStatistic("AUDIO_CODEC", stream.Codec); + args.RecordStatisticRunningTotals("CODEC", stream.Codec); + args.RecordStatisticRunningTotals("AUDIO_CODEC", stream.Codec); } } @@ -121,7 +121,7 @@ public class VideoFile : VideoNode if (resName != null) { args.Logger?.ILog("Video Resolution: " + resName); - args.RecordStatistic("VIDEO_RESOLUTION", resName); + args.RecordStatisticRunningTotals("VIDEO_RESOLUTION", resName); } string extension = FileHelper.GetExtension(args.FileName).ToLowerInvariant().TrimStart('.'); @@ -144,7 +144,7 @@ public class VideoFile : VideoNode if (string.IsNullOrEmpty(container) == false) { args.Logger?.ILog("Video Container: " + container); - args.RecordStatistic("VIDEO_CONTAINER", container); + args.RecordStatisticRunningTotals("VIDEO_CONTAINER", container); } diff --git a/VideoNodes/Plugin.cs b/VideoNodes/Plugin.cs index eb77bcf6..f5ebe0e5 100644 --- a/VideoNodes/Plugin.cs +++ b/VideoNodes/Plugin.cs @@ -5,10 +5,16 @@ using FileFlows.Plugin.Attributes; public class Plugin : FileFlows.Plugin.IPlugin { + /// public Guid Uid => new Guid("881b486b-4b38-4e66-b39e-fbc0fc9deee1"); + /// public string Name => "Video Nodes"; + /// public string MinimumVersion => "1.0.4.2019"; + /// + public string Icon => "svg:video"; + /// public void Init() { } diff --git a/VideoNodes/VideoNodes/EncodingNode.cs b/VideoNodes/VideoNodes/EncodingNode.cs index c9232399..7a4bf83c 100644 --- a/VideoNodes/VideoNodes/EncodingNode.cs +++ b/VideoNodes/VideoNodes/EncodingNode.cs @@ -166,11 +166,11 @@ namespace FileFlows.VideoNodes } } - private void EncoderOnOnStatChange(string name, object value, bool recordStatistic) + private void EncoderOnOnStatChange(string name, string value, bool recordStatistic) { Args.AdditionalInfoRecorder?.Invoke(name, value, 1, new TimeSpan(0, 1, 0)); if(recordStatistic) - Args.RecordStatistic(name, value); + Args.RecordStatisticRunningTotals(name, value); } public string CheckVideoCodec(string ffmpeg, string vidparams)