mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-30 01:50:33 -06:00
FF-1948: Language remover tests
This commit is contained in:
@@ -6,5 +6,8 @@
|
||||
<TestId>MSTest::CF96D3D1-1D8B-47F7-BEA7-BB238F7A566A::net8.0::FileFlows.VideoNodes.Tests.FfmpegBuilderTests.FFmpegBuilder_SubtitleBurnInTests.BurnIn</TestId>
|
||||
<TestId>MSTest::CF96D3D1-1D8B-47F7-BEA7-BB238F7A566A::net8.0::VideoNodes.Tests.SubtitleExtractorTests.SubtitleExtractor_Extension_Test</TestId>
|
||||
<TestId>MSTest::CF96D3D1-1D8B-47F7-BEA7-BB238F7A566A::net8.0::VideoNodes.Tests.SubtitleExtractorTests</TestId>
|
||||
<TestId>MSTest::CF96D3D1-1D8B-47F7-BEA7-BB238F7A566A::net8.0::FileFlows.VideoNodes.Tests.FfmpegBuilderTests.FfmpegBuilder_LanguageRemoverTests.KeepOnlyGerman</TestId>
|
||||
<TestId>MSTest::CF96D3D1-1D8B-47F7-BEA7-BB238F7A566A::net8.0::FileFlows.VideoNodes.Tests.FfmpegBuilderTests.FfmpegBuilder_LanguageRemoverTests.RemoveEnglishAudio</TestId>
|
||||
<TestId>MSTest::CF96D3D1-1D8B-47F7-BEA7-BB238F7A566A::net8.0::FileFlows.VideoNodes.Tests.FfmpegBuilderTests.FfmpegBuilder_LanguageRemoverTests</TestId>
|
||||
</TestAncestor>
|
||||
</SessionState></s:String></wpf:ResourceDictionary>
|
||||
@@ -113,7 +113,7 @@ public class FFmpegBuilderLanguageRemover: FfmpegBuilderNode
|
||||
if (string.IsNullOrWhiteSpace(language))
|
||||
continue;
|
||||
|
||||
matches = LanguageHelper.Matches(args, stream.Language, language);
|
||||
matches = LanguageHelper.Matches(args, language, stream.Language);
|
||||
if (matches)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,88 @@ public class FfmpegBuilder_LanguageRemoverTests : VideoTestBase
|
||||
Model = ffStart.GetModel();
|
||||
}
|
||||
|
||||
private void Prepare(string german = "deu")
|
||||
{
|
||||
args = GetVideoNodeParameters();
|
||||
VideoFile vf = new VideoFile();
|
||||
vf.PreExecute(args);
|
||||
vf.Execute(args);
|
||||
vii = (VideoInfo)args.Parameters["VideoInfo"];
|
||||
|
||||
vii.AudioStreams = new List<AudioStream>
|
||||
{
|
||||
new AudioStream
|
||||
{
|
||||
Index = 2,
|
||||
IndexString = "0:a:0",
|
||||
Language = "en",
|
||||
Codec = "AC3",
|
||||
Channels = 5.1f
|
||||
},
|
||||
new AudioStream
|
||||
{
|
||||
Index = 3,
|
||||
IndexString = "0:a:1",
|
||||
Language = "en",
|
||||
Codec = "AAC",
|
||||
Channels = 2
|
||||
},
|
||||
new AudioStream
|
||||
{
|
||||
Index = 4,
|
||||
IndexString = "0:a:3",
|
||||
Language = "fre",
|
||||
Codec = "AAC",
|
||||
Channels = 2
|
||||
},
|
||||
new AudioStream
|
||||
{
|
||||
Index = 5,
|
||||
IndexString = "0:a:4",
|
||||
Language = german,
|
||||
Codec = "AAC",
|
||||
Channels = 5.1f
|
||||
}
|
||||
};
|
||||
|
||||
vii.SubtitleStreams = new List<SubtitleStream>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Index = 5,
|
||||
IndexString = "0:s:4",
|
||||
Language = german,
|
||||
Codec = "SRT"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Index = 2,
|
||||
IndexString = "0:s:0",
|
||||
Language = "en",
|
||||
Codec = "SRT"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Index = 3,
|
||||
IndexString = "0:s:1",
|
||||
Language = "en",
|
||||
Codec = "SRT"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Index = 4,
|
||||
IndexString = "0:s:3",
|
||||
Language = "fre",
|
||||
Codec = "SUP",
|
||||
}
|
||||
};
|
||||
|
||||
FfmpegBuilderStart ffStart = new();
|
||||
ffStart.PreExecute(args);
|
||||
Assert.AreEqual(1, ffStart.Execute(args));
|
||||
Model = ffStart.GetModel();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test German is matched and removed
|
||||
/// </summary>
|
||||
@@ -155,6 +237,38 @@ public class FfmpegBuilder_LanguageRemoverTests : VideoTestBase
|
||||
Assert.IsFalse(nonDeleted.Any(x =>
|
||||
x.Language.Contains("en", StringComparison.InvariantCultureIgnoreCase)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test German is matched and removed
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void KeepOnlyGerman()
|
||||
{
|
||||
Prepare("ger");
|
||||
int originaluNonDeletedSubtitles = Model.SubtitleStreams.Count(x => x.Deleted == false);
|
||||
FFmpegBuilderLanguageRemover ffLangRemover = new();
|
||||
ffLangRemover.Languages = [ "deu"];
|
||||
ffLangRemover.NotMatching = true;
|
||||
ffLangRemover.StreamType = "Subtitle";
|
||||
ffLangRemover.PreExecute(args);
|
||||
Assert.AreEqual(1, ffLangRemover.Execute(args));
|
||||
List<FfmpegSubtitleStream> nonDeletedSubtitles = new();
|
||||
|
||||
Logger.ILog(new string('-', 100));
|
||||
foreach (var sub in Model.SubtitleStreams.Where(x => x.Deleted))
|
||||
{
|
||||
Logger.ILog("Deleted subtitle: " + sub);
|
||||
}
|
||||
Logger.ILog(new string('-', 100));
|
||||
foreach (var sub in Model.SubtitleStreams.Where(x => x.Deleted == false))
|
||||
{
|
||||
Logger.ILog("Non deleted subtitle: " + sub);
|
||||
nonDeletedSubtitles.Add(sub);
|
||||
}
|
||||
Assert.AreNotEqual(originaluNonDeletedSubtitles, nonDeletedSubtitles.Count);
|
||||
Assert.AreEqual(nonDeletedSubtitles.Count, 1);
|
||||
Assert.AreEqual("ger", nonDeletedSubtitles[0].Language);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "Brennt Untertitel in die Videodatei ein.",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "Benutzerdefinierte Spurauswahl",
|
||||
"CustomTrackSelection": "Spurauswahl",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "Eigenschaft",
|
||||
"TrackSelectionOptionsValue": "Wert"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "Burns subtitles into the video file.",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "Custom Track Selection",
|
||||
"CustomTrackSelection": "Track Selection",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "Property",
|
||||
"TrackSelectionOptionsValue": "Value"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "Quema subtítulos en el archivo de video.",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "Selección de pista personalizada",
|
||||
"CustomTrackSelection": "Selección de pista",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "Propiedad",
|
||||
"TrackSelectionOptionsValue": "Valor"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "Incruste les sous-titres dans le fichier vidéo.",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "Sélection de piste personnalisée",
|
||||
"CustomTrackSelection": "Sélection de piste",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "Propriété",
|
||||
"TrackSelectionOptionsValue": "Valeur"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "Masterizza i sottotitoli nel file video.",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "Selezione traccia personalizzata",
|
||||
"CustomTrackSelection": "Selezione traccia",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "Proprietà",
|
||||
"TrackSelectionOptionsValue": "Valore"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "字幕をビデオファイルに焼き付けます。",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "カスタムトラック選択",
|
||||
"CustomTrackSelection": "トラック選択",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "プロパティ",
|
||||
"TrackSelectionOptionsValue": "値"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "자막을 비디오 파일에 구워 넣습니다.",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "사용자 정의 트랙 선택",
|
||||
"CustomTrackSelection": "트랙 선택",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "속성",
|
||||
"TrackSelectionOptionsValue": "값"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "Brandt ondertitels in het videobestand.",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "Aangepaste trackselectie",
|
||||
"CustomTrackSelection": "Trackselectie",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "Eigenschap",
|
||||
"TrackSelectionOptionsValue": "Waarde"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "Grava legendas no arquivo de vídeo.",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "Seleção de faixa personalizada",
|
||||
"CustomTrackSelection": "Seleção de faixa",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "Propriedade",
|
||||
"TrackSelectionOptionsValue": "Valor"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "Встраивает субтитры в видеофайл.",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "Пользовательский выбор дорожки",
|
||||
"CustomTrackSelection": "Выбор дорожки",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "Свойство",
|
||||
"TrackSelectionOptionsValue": "Значение"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "Bränner in undertexter i videofilen.",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "Anpassat spårval",
|
||||
"CustomTrackSelection": "Spårval",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "Egenskap",
|
||||
"TrackSelectionOptionsValue": "Värde"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "将字幕烧录到视频文件中。",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "自定义轨道选择",
|
||||
"CustomTrackSelection": "轨道选择",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "属性",
|
||||
"TrackSelectionOptionsValue": "值"
|
||||
|
||||
@@ -641,7 +641,7 @@
|
||||
"Description": "將字幕燒錄到影片文件中。",
|
||||
"Label": "FFMPEG Builder: Subtitle Burn-In",
|
||||
"Fields": {
|
||||
"CustomTrackSelection": "自訂軌道選擇",
|
||||
"CustomTrackSelection": "軌道選擇",
|
||||
"TrackSelectionOptions": "",
|
||||
"TrackSelectionOptionsKey": "屬性",
|
||||
"TrackSelectionOptionsValue": "值"
|
||||
|
||||
Reference in New Issue
Block a user