mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-30 09:49:30 -06:00
FF-1577 - fixing Video Has Errors
This commit is contained in:
@@ -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);
|
||||
|
||||
37
VideoNodes/Tests/VideoHasErrorsTests.cs
Normal file
37
VideoNodes/Tests/VideoHasErrorsTests.cs
Normal file
@@ -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
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user