diff --git a/FileFlows.Plugin.dll b/FileFlows.Plugin.dll index 3a17156c..d4ef1979 100644 Binary files a/FileFlows.Plugin.dll and b/FileFlows.Plugin.dll differ diff --git a/FileFlows.Plugin.pdb b/FileFlows.Plugin.pdb index 99088084..3eb58208 100644 Binary files a/FileFlows.Plugin.pdb and b/FileFlows.Plugin.pdb differ diff --git a/VideoNodes/LogicalNodes/VideoHasErrors.cs b/VideoNodes/LogicalNodes/VideoHasErrors.cs index 81fe7118..bf5d2e53 100644 --- a/VideoNodes/LogicalNodes/VideoHasErrors.cs +++ b/VideoNodes/LogicalNodes/VideoHasErrors.cs @@ -126,7 +126,7 @@ public class VideoHasErrors: VideoNode string output = process.StandardError.ReadToEnd(); process.WaitForExit(); - if (output.Contains("error")) + if (output.ToLowerInvariant().Contains("error")) { args.Logger?.ILog("Errors detected in file"); args.Logger?.WLog(output); diff --git a/VideoNodes/Tests/VideoHasErrorsTests.cs b/VideoNodes/Tests/VideoHasErrorsTests.cs new file mode 100644 index 00000000..a25c28fa --- /dev/null +++ b/VideoNodes/Tests/VideoHasErrorsTests.cs @@ -0,0 +1,37 @@ +#if(DEBUG) + +using FileFlows.VideoNodes; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace VideoNodes.Tests; + +[TestClass] +public class VideoHasErrorsTests : TestBase +{ + [TestMethod] + public void VideoHasErrors_Video() + { + string file = TestFile_Corrupt; + var args = new NodeParameters(file, Logger, false, string.Empty, new LocalFileService()); + args.GetToolPathActual = (string tool) => + { + if(tool.ToLowerInvariant() == "ffmpeg") return FfmpegPath; + if(tool.ToLowerInvariant() == "ffprobe") return FfprobePath; + return null; + }; + args.TempPath = TempPath; + + VideoFile vf = new(); + vf.PreExecute(args); + vf.Execute(args); + + VideoHasErrors element = new(); + element.PreExecute(args); + int output = element.Execute(args); + + Assert.AreEqual(1, output); + } +} + + +#endif \ No newline at end of file diff --git a/VideoNodes/Tests/_TestBase.cs b/VideoNodes/Tests/_TestBase.cs index 85f59ce5..f1ce8eeb 100644 --- a/VideoNodes/Tests/_TestBase.cs +++ b/VideoNodes/Tests/_TestBase.cs @@ -30,6 +30,7 @@ public abstract class TestBase public string TestPath { get; private set; } public string TempPath { get; private set; } public string FfmpegPath { get; private set; } + public string FfprobePath { get; private set; } public readonly bool IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); public readonly bool IsLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); @@ -50,11 +51,12 @@ public abstract class TestBase this.TestPath = this.TestPath?.EmptyAsNull() ?? (IsLinux ? "~/src/ff-files/test-files/videos" : @"d:\videos\testfiles"); this.TempPath = this.TempPath?.EmptyAsNull() ?? (IsLinux ? "~/src/ff-files/temp" : @"d:\videos\temp"); this.FfmpegPath = this.FfmpegPath?.EmptyAsNull() ?? (IsLinux ? "/usr/local/bin/ffmpeg" : @"C:\utils\ffmpeg\ffmpeg.exe"); - + this.FfprobePath = this.FfmpegPath?.EmptyAsNull() ?? (IsLinux ? "/usr/local/bin/ffprobe" : @"C:\utils\ffprobe\ffprobe.exe"); this.TestPath = this.TestPath.Replace("~/", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/"); this.TempPath = this.TempPath.Replace("~/", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/"); this.FfmpegPath = this.FfmpegPath.Replace("~/", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/"); + this.FfprobePath = this.FfprobePath.Replace("~/", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/"); if (Directory.Exists(this.TempPath) == false) Directory.CreateDirectory(this.TempPath); @@ -91,6 +93,7 @@ public abstract class TestBase protected string TestFile_MovText_Mp4 => Path.Combine(TestPath, "movtext.mp4"); protected string TestFile_BasicMkv => Path.Combine(TestPath, "basic.mkv"); + protected string TestFile_Corrupt => Path.Combine(TestPath, "corrupt.mkv"); protected string TestFile_Webvtt => Path.Combine(TestPath, "webvtt4.mkv"); protected string TestFile_Tag => Path.Combine(TestPath, "tag.mp4"); protected string TestFile_Sitcom => Path.Combine(TestPath, "sitcom.mkv");