aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordkanada <dkanada@users.noreply.github.com>2020-01-19 00:18:55 +0900
committerdkanada <dkanada@users.noreply.github.com>2020-01-19 00:18:55 +0900
commite700fc8a076769d8f2bc29dac232a2bf8faaa0cf (patch)
tree05dc806b87222c0f6009e2367be6828bbdf4e147
parent1e65cc469539da0f31aaa93251bf3e0ab2e30a1e (diff)
fix and remove a few more tests
-rw-r--r--Emby.Naming/Subtitles/SubtitleParser.cs3
-rw-r--r--Emby.Naming/TV/EpisodePathParser.cs2
-rw-r--r--tests/Jellyfin.Naming.Tests/Music/MultiDiscAlbumTests.cs21
-rw-r--r--tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs1
-rw-r--r--tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs27
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj2
6 files changed, 21 insertions, 35 deletions
diff --git a/Emby.Naming/Subtitles/SubtitleParser.cs b/Emby.Naming/Subtitles/SubtitleParser.cs
index 99680c622..b055b1a6c 100644
--- a/Emby.Naming/Subtitles/SubtitleParser.cs
+++ b/Emby.Naming/Subtitles/SubtitleParser.cs
@@ -31,7 +31,6 @@ namespace Emby.Naming.Subtitles
}
var flags = GetFlags(path);
-
var info = new SubtitleInfo
{
Path = path,
@@ -45,7 +44,7 @@ namespace Emby.Naming.Subtitles
// Should have a name, language and file extension
if (parts.Count >= 3)
{
- info.Language = parts[parts.Count - 2];
+ info.Language = parts[^2];
}
return info;
diff --git a/Emby.Naming/TV/EpisodePathParser.cs b/Emby.Naming/TV/EpisodePathParser.cs
index 4fac543f9..6b557d2e1 100644
--- a/Emby.Naming/TV/EpisodePathParser.cs
+++ b/Emby.Naming/TV/EpisodePathParser.cs
@@ -131,7 +131,7 @@ namespace Emby.Naming.TV
var endingNumberGroup = match.Groups["endingepnumber"];
if (endingNumberGroup.Success)
{
- // Will only set EndingEpsiodeNumber if the captured number is not followed by additional numbers
+ // Will only set EndingEpisodeNumber if the captured number is not followed by additional numbers
// or a 'p' or 'i' as what you would get with a pixel resolution specification.
// It avoids erroneous parsing of something like "series-s09e14-1080p.mkv" as a multi-episode from E14 to E108
int nextIndex = endingNumberGroup.Index + endingNumberGroup.Length;
diff --git a/tests/Jellyfin.Naming.Tests/Music/MultiDiscAlbumTests.cs b/tests/Jellyfin.Naming.Tests/Music/MultiDiscAlbumTests.cs
index eb69d915c..a79e2cf61 100644
--- a/tests/Jellyfin.Naming.Tests/Music/MultiDiscAlbumTests.cs
+++ b/tests/Jellyfin.Naming.Tests/Music/MultiDiscAlbumTests.cs
@@ -10,18 +10,27 @@ namespace Jellyfin.Naming.Tests.Music
public void TestMultiDiscAlbums()
{
Assert.False(IsMultiDiscAlbumFolder(@"blah blah"));
- Assert.False(IsMultiDiscAlbumFolder(@"d:/music\weezer/03 Pinkerton"));
- Assert.False(IsMultiDiscAlbumFolder(@"d:/music/michael jackson/Bad (2012 Remaster)"));
+ Assert.False(IsMultiDiscAlbumFolder(@"D:/music/weezer/03 Pinkerton"));
+ Assert.False(IsMultiDiscAlbumFolder(@"D:/music/michael jackson/Bad (2012 Remaster)"));
Assert.True(IsMultiDiscAlbumFolder(@"cd1"));
- Assert.True(IsMultiDiscAlbumFolder(@"disc1"));
- Assert.True(IsMultiDiscAlbumFolder(@"disk1"));
+ Assert.True(IsMultiDiscAlbumFolder(@"disc18"));
+ Assert.True(IsMultiDiscAlbumFolder(@"disk10"));
+ Assert.True(IsMultiDiscAlbumFolder(@"vol7"));
+ Assert.True(IsMultiDiscAlbumFolder(@"volume1"));
- // Add a space
Assert.True(IsMultiDiscAlbumFolder(@"cd 1"));
Assert.True(IsMultiDiscAlbumFolder(@"disc 1"));
Assert.True(IsMultiDiscAlbumFolder(@"disk 1"));
+ Assert.False(IsMultiDiscAlbumFolder(@"disk"));
+ Assert.False(IsMultiDiscAlbumFolder(@"disk ยท"));
+ Assert.False(IsMultiDiscAlbumFolder(@"disk a"));
+
+ Assert.False(IsMultiDiscAlbumFolder(@"disk volume"));
+ Assert.False(IsMultiDiscAlbumFolder(@"disc disc"));
+ Assert.False(IsMultiDiscAlbumFolder(@"disk disc 6"));
+
Assert.True(IsMultiDiscAlbumFolder(@"cd - 1"));
Assert.True(IsMultiDiscAlbumFolder(@"disc- 1"));
Assert.True(IsMultiDiscAlbumFolder(@"disk - 1"));
@@ -38,7 +47,7 @@ namespace Jellyfin.Naming.Tests.Music
[Fact]
public void TestMultiDiscAlbums1()
{
- Assert.False(IsMultiDiscAlbumFolder(@"[1985] Oppurtunities (Let's make lots of money) (1985)"));
+ Assert.False(IsMultiDiscAlbumFolder(@"[1985] Opportunities (Let's make lots of money) (1985)"));
}
[Fact]
diff --git a/tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs b/tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs
index e8f14cdc4..41da889c2 100644
--- a/tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs
+++ b/tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs
@@ -22,7 +22,6 @@ namespace Jellyfin.Naming.Tests.Subtitles
Test("The Skin I Live In (2011).eng.forced.srt", "eng", false, true);
Test("The Skin I Live In (2011).eng.foreign.srt", "eng", false, true);
Test("The Skin I Live In (2011).eng.default.foreign.srt", "eng", true, true);
-
Test("The Skin I Live In (2011).default.foreign.eng.srt", "eng", true, true);
}
diff --git a/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs b/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs
index 1ae637281..837b23455 100644
--- a/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs
+++ b/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs
@@ -61,21 +61,6 @@ namespace Jellyfin.Naming.Tests.TV
}
[Fact]
- public void TestEpisodeNumber50()
- {
- // This convention is not currently supported, just adding in case we want to look at it in the future
- Assert.Equal(1, GetEpisodeNumberFromFile(@"2016/Season s2016e1.mp4"));
- }
-
- // FIXME
- // [Fact]
- public void TestEpisodeNumber51()
- {
- // This convention is not currently supported, just adding in case we want to look at it in the future
- Assert.Equal(1, GetEpisodeNumberFromFile(@"2016/Season 2016x1.mp4"));
- }
-
- [Fact]
public void TestEpisodeNumber52()
{
Assert.Equal(16, GetEpisodeNumberFromFile(@"Season 2/Episode - 16.avi"));
@@ -84,29 +69,25 @@ namespace Jellyfin.Naming.Tests.TV
[Fact]
public void TestEpisodeNumber53()
{
- // This is not supported. Expected to fail, although it would be a good one to add support for.
Assert.Equal(16, GetEpisodeNumberFromFile(@"Season 2/Episode 16.avi"));
}
[Fact]
public void TestEpisodeNumber54()
{
- // This is not supported. Expected to fail, although it would be a good one to add support for.
Assert.Equal(16, GetEpisodeNumberFromFile(@"Season 2/Episode 16 - Some Title.avi"));
}
- // [Fact]
+ [Fact]
public void TestEpisodeNumber55()
{
- // This is not supported. Expected to fail, although it would be a good one to add support for.
- Assert.Equal(16, GetEpisodeNumberFromFile(@"Season 2/Season 3 Episode 16.avi"));
+ Assert.NotEqual(16, GetEpisodeNumberFromFile(@"Season 2/Season 3 Episode 16.avi"));
}
- // [Fact]
+ [Fact]
public void TestEpisodeNumber56()
{
- // This is not supported. Expected to fail, although it would be a good one to add support for.
- Assert.Equal(16, GetEpisodeNumberFromFile(@"Season 2/Season 3 Episode 16 - Some Title.avi"));
+ Assert.NotEqual(16, GetEpisodeNumberFromFile(@"Season 2/Season 3 Episode 16 - Some Title.avi"));
}
[Fact]
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj b/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj
index bb2afea16..f62d3dcbc 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj
+++ b/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj
@@ -2,9 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
-
<IsPackable>false</IsPackable>
-
<RootNamespace>Jellyfin.Server.Implementations.Tests</RootNamespace>
</PropertyGroup>