FF-1968: subtitle track merge can use starts with

This commit is contained in:
John Andrews
2024-12-09 10:25:03 +13:00
parent db527e8115
commit e8a50d2ada
3 changed files with 25 additions and 1 deletions

View File

@@ -11,5 +11,6 @@
<TestId>MSTest::CF96D3D1-1D8B-47F7-BEA7-BB238F7A566A::net8.0::FileFlows.VideoNodes.Tests.FfmpegBuilderTests.FfmpegBuilder_LanguageRemoverTests</TestId>
<TestId>MSTest::7AE24315-9FE7-429F-83D9-C989CFF5420D::net8.0::BasicNodes.Tests.LogVariablesTests</TestId>
<TestId>MSTest::7AE24315-9FE7-429F-83D9-C989CFF5420D::net8.0::BasicNodes.Tests.VariableMatchTests</TestId>
<TestId>MSTest::CF96D3D1-1D8B-47F7-BEA7-BB238F7A566A::net8.0::FileFlows.VideoNodes.Tests.FfmpegBuilderTests.FfmpegBuilder_BasicTests.FfmpegBuilder_SubtitleTrackMerge_FileMatchesTests_WithNumber</TestId>
</TestAncestor>
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>

View File

@@ -160,7 +160,6 @@ public class FfmpegBuilderSubtitleTrackMerge : FfmpegBuilderNode
language = language?.EmptyAsNull() ?? args.ReplaceVariables(Language ?? string.Empty, stripMissing: true);
forced |= Forced;
string subTitle = args.ReplaceVariables(Title ?? string.Empty, stripMissing: true)?.EmptyAsNull() ?? language ?? string.Empty;
@@ -271,6 +270,9 @@ public class FfmpegBuilderSubtitleTrackMerge : FfmpegBuilderNode
return true;
}
if (otherName.StartsWith(inputName, StringComparison.InvariantCultureIgnoreCase))
return true;
return false;
bool HasSection(ref string input, string section)

View File

@@ -592,6 +592,27 @@ public class FfmpegBuilder_BasicTests : VideoTestBase
}
}
[TestMethod]
public void FfmpegBuilder_SubtitleTrackMerge_FileMatchesTests_WithNumber()
{
FfmpegBuilderSubtitleTrackMerge ffSubMerge = new();
foreach (var item in new[] {
(File: "The Big Bang Theory_S01E01_Pilot.1.en.closedcaptions.srt", Language: "English (CC)", IsMatch: true, Forced: false),
(File: "The Big Bang Theory_S01E01_Pilot.2.en.closedcaptions.srt", Language: "English (CC)", IsMatch: true, Forced: false),
(File: "The Big Bang Theory_S01E01_Pilot.1.en.srt", Language: "English", IsMatch: true, Forced: false),
(File: "The Big Bang Theory_S01E01_Pilot.1.it.closedcaptions.srt", Language: "Italian (CC)", IsMatch: true, Forced: false),
(File: "The Big Bang Theory_S01E01_Pilot.1.it.forced.srt", Language: "Italian", IsMatch: true, Forced: true),
})
{
bool isMatch = ffSubMerge.FilenameMatches("The Big Bang Theory_S01E01_Pilot.mp4", item.File, out string lang, out bool forced);
Assert.AreEqual(item.IsMatch, isMatch, "Not match: " + item.File);
Assert.AreEqual(item.Forced, forced);
Assert.AreEqual(item.Language, lang, "Language not matching in: " + item.Language);
}
}
[TestMethod]
public void FfmpegBuilder_Scale()
{