mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-01-06 07:00:16 -06:00
fixed issue with has stream language always failing
This commit is contained in:
@@ -73,7 +73,7 @@ public class VideoHasStream : VideoNode
|
||||
return false;
|
||||
if (CodecMatches(x.Codec) == MatchResult.NoMatch)
|
||||
return false;
|
||||
if (LanguageMatches(x.Codec) == MatchResult.NoMatch)
|
||||
if (LanguageMatches(x.Language) == MatchResult.NoMatch)
|
||||
return false;
|
||||
if (this.Channels > 0 && Math.Abs(x.Channels - this.Channels) > 0.05f)
|
||||
return false;
|
||||
@@ -88,7 +88,7 @@ public class VideoHasStream : VideoNode
|
||||
return false;
|
||||
if (CodecMatches(x.Codec) == MatchResult.NoMatch)
|
||||
return false;
|
||||
if (LanguageMatches(x.Codec) == MatchResult.NoMatch)
|
||||
if (LanguageMatches(x.Language) == MatchResult.NoMatch)
|
||||
return false;
|
||||
return true;
|
||||
}).Any();
|
||||
|
||||
@@ -151,32 +151,39 @@ public class FfmpegBuilder_BasicTests
|
||||
|
||||
|
||||
FfmpegBuilderStart ffStart = new();
|
||||
ffStart.PreExecute(args);
|
||||
Assert.AreEqual(1, ffStart.Execute(args));
|
||||
|
||||
FfmpegBuilderVideoCodec ffEncode = new();
|
||||
ffEncode.VideoCodec = "h264";
|
||||
ffEncode.PreExecute(args);
|
||||
ffEncode.Execute(args);
|
||||
|
||||
FfmpegBuilderAudioTrackRemover ffAudioRemover = new();
|
||||
ffAudioRemover.RemoveAll = true;
|
||||
ffAudioRemover.PreExecute(args);
|
||||
ffAudioRemover.Execute(args);
|
||||
|
||||
FfmpegBuilderAudioAddTrack ffAddAudio = new();
|
||||
ffAddAudio.Codec = "ac3";
|
||||
ffAddAudio.Index = 1;
|
||||
ffAddAudio.PreExecute(args);
|
||||
ffAddAudio.Execute(args);
|
||||
|
||||
FfmpegBuilderAudioAddTrack ffAddAudio2 = new();
|
||||
ffAddAudio2.Codec = "aac";
|
||||
ffAddAudio2.Index = 2;
|
||||
ffAddAudio2.PreExecute(args);
|
||||
ffAddAudio2.Execute(args);
|
||||
|
||||
FfmpegBuilderAudioNormalization ffAudioNormalize = new();
|
||||
ffAudioNormalize.TwoPass = false;
|
||||
ffAudioNormalize.AllAudio = true;
|
||||
ffAudioNormalize.PreExecute(args);
|
||||
ffAudioNormalize.Execute(args);
|
||||
|
||||
FfmpegBuilderExecutor ffExecutor = new();
|
||||
ffExecutor.PreExecute(args);
|
||||
int result = ffExecutor.Execute(args);
|
||||
|
||||
string log = logger.ToString();
|
||||
@@ -608,6 +615,10 @@ public class FfmpegBuilder_BasicTests
|
||||
|
||||
string log = logger.ToString();
|
||||
Assert.AreEqual(1, result);
|
||||
|
||||
|
||||
var vi2 = new VideoInfoHelper(ffmpeg, logger);
|
||||
var vii2 = vi.Read(args.WorkingFile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -185,6 +185,57 @@ public class VideoHasStreamTests : TestBase
|
||||
|
||||
Assert.AreEqual(1, output);
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void VideoHasStream_Audio_Lang_Pass()
|
||||
{
|
||||
string file = TestFile_MovText_Mp4;
|
||||
var vi = new VideoInfoHelper(FfmpegPath, new TestLogger());
|
||||
var vii = vi.Read(file);
|
||||
|
||||
VideoHasStream node = new();
|
||||
node.Language = "ita";
|
||||
node.Stream = "Audio";
|
||||
|
||||
var args = new NodeParameters(file, new TestLogger(), false, string.Empty);
|
||||
args.GetToolPathActual = (string tool) => FfmpegPath;
|
||||
args.TempPath = TempPath;
|
||||
|
||||
var vf = new VideoFile();
|
||||
vf.PreExecute(args);
|
||||
Assert.AreEqual(1, vf.Execute(args));
|
||||
|
||||
node.PreExecute(args);
|
||||
int output = node.Execute(args);
|
||||
|
||||
Assert.AreEqual(1, output);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void VideoHasStream_Audio_Lang_Fail()
|
||||
{
|
||||
string file = TestFile_MovText_Mp4;
|
||||
var vi = new VideoInfoHelper(FfmpegPath, new TestLogger());
|
||||
var vii = vi.Read(file);
|
||||
|
||||
VideoHasStream node = new();
|
||||
node.Language = "mao";
|
||||
node.Stream = "Audio";
|
||||
|
||||
var args = new NodeParameters(file, new TestLogger(), false, string.Empty);
|
||||
args.GetToolPathActual = (string tool) => FfmpegPath;
|
||||
args.TempPath = TempPath;
|
||||
|
||||
var vf = new VideoFile();
|
||||
vf.PreExecute(args);
|
||||
Assert.AreEqual(1, vf.Execute(args));
|
||||
|
||||
node.PreExecute(args);
|
||||
int output = node.Execute(args);
|
||||
|
||||
Assert.AreEqual(2, output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -49,6 +49,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_Tag => Path.Combine(TestPath, "tag.mp4");
|
||||
protected string TestFile_Pgs => Path.Combine(TestPath, "pgs.mkv");
|
||||
|
||||
Reference in New Issue
Block a user