This commit is contained in:
Bond_009
2021-10-05 21:47:59 +02:00
parent d245e45254
commit 67147400bf
3 changed files with 37 additions and 35 deletions

View File

@@ -18,30 +18,31 @@ namespace Jellyfin.Naming.Tests.Video
[Fact]
public void TestKodiExtras()
{
Test("trailer.mp4", ExtraType.Trailer, _videoOptions);
Test("300-trailer.mp4", ExtraType.Trailer, _videoOptions);
Test("trailer.mp4", ExtraType.Trailer);
Test("300-trailer.mp4", ExtraType.Trailer);
Test("theme.mp3", ExtraType.ThemeSong, _videoOptions);
Test("theme.mp3", ExtraType.ThemeSong);
}
[Fact]
public void TestExpandedExtras()
{
Test("trailer.mp4", ExtraType.Trailer, _videoOptions);
Test("trailer.mp3", null, _videoOptions);
Test("300-trailer.mp4", ExtraType.Trailer, _videoOptions);
Test("trailer.mp4", ExtraType.Trailer);
Test("trailer.mp3", null);
Test("300-trailer.mp4", ExtraType.Trailer);
Test("stuff trailerthings.mkv", null);
Test("theme.mp3", ExtraType.ThemeSong, _videoOptions);
Test("theme.mkv", null, _videoOptions);
Test("theme.mp3", ExtraType.ThemeSong);
Test("theme.mkv", null);
Test("300-scene.mp4", ExtraType.Scene, _videoOptions);
Test("300-scene2.mp4", ExtraType.Scene, _videoOptions);
Test("300-clip.mp4", ExtraType.Clip, _videoOptions);
Test("300-scene.mp4", ExtraType.Scene);
Test("300-scene2.mp4", ExtraType.Scene);
Test("300-clip.mp4", ExtraType.Clip);
Test("300-deleted.mp4", ExtraType.DeletedScene, _videoOptions);
Test("300-deletedscene.mp4", ExtraType.DeletedScene, _videoOptions);
Test("300-interview.mp4", ExtraType.Interview, _videoOptions);
Test("300-behindthescenes.mp4", ExtraType.BehindTheScenes, _videoOptions);
Test("300-deleted.mp4", ExtraType.DeletedScene);
Test("300-deletedscene.mp4", ExtraType.DeletedScene);
Test("300-interview.mp4", ExtraType.Interview);
Test("300-behindthescenes.mp4", ExtraType.BehindTheScenes);
}
[Theory]
@@ -55,9 +56,9 @@ namespace Jellyfin.Naming.Tests.Video
[InlineData(ExtraType.Unknown, "extras")]
public void TestDirectories(ExtraType type, string dirName)
{
Test(dirName + "/300.mp4", type, _videoOptions);
Test("300/" + dirName + "/something.mkv", type, _videoOptions);
Test("/data/something/Movies/300/" + dirName + "/whoknows.mp4", type, _videoOptions);
Test(dirName + "/300.mp4", type);
Test("300/" + dirName + "/something.mkv", type);
Test("/data/something/Movies/300/" + dirName + "/whoknows.mp4", type);
}
[Theory]
@@ -66,32 +67,25 @@ namespace Jellyfin.Naming.Tests.Video
[InlineData("The Big Short")]
public void TestNonExtraDirectories(string dirName)
{
Test(dirName + "/300.mp4", null, _videoOptions);
Test("300/" + dirName + "/something.mkv", null, _videoOptions);
Test("/data/something/Movies/300/" + dirName + "/whoknows.mp4", null, _videoOptions);
Test("/data/something/Movies/" + dirName + "/" + dirName + ".mp4", null, _videoOptions);
Test(dirName + "/300.mp4", null);
Test("300/" + dirName + "/something.mkv", null);
Test("/data/something/Movies/300/" + dirName + "/whoknows.mp4", null);
Test("/data/something/Movies/" + dirName + "/" + dirName + ".mp4", null);
}
[Fact]
public void TestSample()
{
Test("300-sample.mp4", ExtraType.Sample, _videoOptions);
Test("300-sample.mp4", ExtraType.Sample);
}
private void Test(string input, ExtraType? expectedType, NamingOptions videoOptions)
private void Test(string input, ExtraType? expectedType)
{
var parser = GetExtraTypeParser(videoOptions);
var parser = GetExtraTypeParser(_videoOptions);
var extraType = parser.GetExtraInfo(input).ExtraType;
if (expectedType == null)
{
Assert.Null(extraType);
}
else
{
Assert.Equal(expectedType, extraType);
}
Assert.Equal(expectedType, extraType);
}
[Fact]