diff options
| author | Bond_009 <Bond.009@outlook.com> | 2020-02-19 22:35:40 +0100 |
|---|---|---|
| committer | Bond_009 <Bond.009@outlook.com> | 2020-02-19 22:35:40 +0100 |
| commit | 620047ab9adeea5fc0d38f51990d456b1300b968 (patch) | |
| tree | 42f606b92fbedcf4f781b1932f5db8c2c4424f6a | |
| parent | cef796a5ba6dd256f425fb87c13d63c724499058 (diff) | |
Fix episode parsing
| -rw-r--r-- | Emby.Naming/Common/NamingOptions.cs | 2 | ||||
| -rw-r--r-- | tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs | 19 |
2 files changed, 17 insertions, 4 deletions
diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs index 1554e61d8..b4f22ed69 100644 --- a/Emby.Naming/Common/NamingOptions.cs +++ b/Emby.Naming/Common/NamingOptions.cs @@ -277,7 +277,7 @@ namespace Emby.Naming.Common // This isn't a Kodi naming rule, but the expression below causes false positives, // so we make sure this one gets tested first. // "Foo Bar 889" - new EpisodeExpression(@".*[\\\/](?![Ee]pisode)(?<seriesname>[\w\s]+?)\s(?<epnumber>\d{1,3})(-(?<endingepnumber>\d{2,3}))*[^\\\/]*$") + new EpisodeExpression(@".*[\\\/](?![Ee]pisode)(?<seriesname>[\w\s]+?)\s(?<epnumber>\d{1,3})(-(?<endingepnumber>\d{2,3}))*[^\\\/x]*$") { IsNamed = true }, diff --git a/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs b/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs index 93c59c9ca..fe6f1515c 100644 --- a/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs +++ b/tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs @@ -6,6 +6,21 @@ namespace Jellyfin.Naming.Tests.TV { public class EpisodeNumberTests { + private readonly NamingOptions _namingOptions = new NamingOptions(); + + [Theory] + [InlineData("Watchmen (2019)/Watchmen 1x03 [WEBDL-720p][EAC3 5.1][h264][-TBS] - She Was Killed by Space Junk.mkv", 3)] + [InlineData("The Daily Show/The Daily Show 25x22 - [WEBDL-720p][AAC 2.0][x264] Noah Baumbach-TBS.mkv", 22)] + [InlineData("Castle Rock 2x01 Que el rio siga su curso [WEB-DL HULU 1080p h264 Dual DD5.1 Subs].mkv", 1)] + [InlineData("'After Life 1x06 Episodio 6 [WEB-DL NF 1080p h264 Dual DD 5.1 Sub].mkv", 6)] + public void GetEpisodeNumberFromFileTest(string path, int? expected) + { + var result = new EpisodePathParser(_namingOptions) + .Parse(path, false); + + Assert.Equal(expected, result.EpisodeNumber); + } + [Fact] public void TestEpisodeNumber1() { @@ -382,9 +397,7 @@ namespace Jellyfin.Naming.Tests.TV private int? GetEpisodeNumberFromFile(string path) { - var options = new NamingOptions(); - - var result = new EpisodePathParser(options) + var result = new EpisodePathParser(_namingOptions) .Parse(path, false); return result.EpisodeNumber; |
