diff --git a/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs index b1160ef21..0d0d704e2 100644 --- a/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs @@ -16,8 +16,6 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Series.Title.S07E22E23.720p.HDTV.X264-DIMENSION", "Series Title", 7, new[] { 22, 23 })] [TestCase("Series Title - S07E22 - S07E23 - And Lots of Security.. [HDTV-720p].mkv", "Series Title", 7, new[] { 22, 23 })] [TestCase("S03E01.S03E02.720p.HDTV.X264-DIMENSION", "", 3, new[] { 1, 2 })] - [TestCase("Series Title - S07E22 - 7x23 - And Lots of Development.. [HDTV-720p].mkv", "Series Title", 7, new[] { 22, 23 })] - [TestCase("S07E22 - 7x23 - And Lots of Development.. [HDTV-720p].mkv", "", 7, new[] { 22, 23 })] [TestCase("2x04x05.720p.BluRay-FUTV", "", 2, new[] { 4, 5 })] [TestCase("S02E04E05.720p.BluRay-FUTV", "", 2, new[] { 4, 5 })] [TestCase("S02E03-04-05.720p.BluRay-FUTV", "", 2, new[] { 3, 4, 5 })] diff --git a/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs index 107ba1a39..105316732 100644 --- a/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs @@ -144,6 +144,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Series Title - [02x01] - Episode 1", "Series Title", 2, 1)] [TestCase("Series.Title.Of.S01E01.xyz", "Series Title Of", 1, 1)] [TestCase("[RlsGrp] Series Title - S01E27 - 24-Hour", "Series Title", 1, 27)] + [TestCase("Series Title - S02E01 1920x910", "Series Title", 2, 1)] //[TestCase("", "", 0, 0)] public void should_parse_single_episode(string postTitle, string title, int seasonNumber, int episodeNumber) { diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index eb64d7c11..0a3266c14 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -46,7 +46,11 @@ namespace NzbDrone.Core.Parser RegexOptions.IgnoreCase | RegexOptions.Compiled), //Multi-Part episodes without a title (S01E05.S01E06) - new Regex(@"^(?:\W*S?(?(?\d{1,3}(?!\d+)))+){2,}", + new Regex(@"^(?:\W*S(?(?\d{1,3}(?!\d+)))+){2,}", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + + //Multi-Part episodes without a title (1x05.1x06) + new Regex(@"^(?:\W*(?(?\d{1,3}(?!\d+)))+){2,}", RegexOptions.IgnoreCase | RegexOptions.Compiled), //Episodes without a title, Multi (S01E04E05, 1x04x05, etc) @@ -101,8 +105,12 @@ namespace NzbDrone.Core.Parser new Regex(@"^\[(?.+?)\][-_. ]?(?.+?)[-_. ]+\(?(?:[-_. ]?#?(?<absoluteepisode>\d{2,3}(\.\d{1,2})?(?!\d+|-[a-z]+)))+\)?(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>\[\w{8}\])?(?:$|\.mkv)", RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Multi-episode Repeated (S01E05 - S01E06, 1x05 - 1x06, etc) - new Regex(@"^(?<title>.+?)(?:(?:[-_\W](?<![()\[!]))+S?(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:(?:[ex]|[-_. ]e){1,2}(?<episode>\d{1,3}(?!\d+)))+){2,}", + //Multi-episode Repeated (S01E05 - S01E06) + new Regex(@"^(?<title>.+?)(?:(?:[-_\W](?<![()\[!]))+S(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:(?:e|[-_. ]e){1,2}(?<episode>\d{1,3}(?!\d+)))+){2,}", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + + //Multi-episode Repeated (1x05 - 1x06) + new Regex(@"^(?<title>.+?)(?:(?:[-_\W](?<![()\[!]))+(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:x{1,2}(?<episode>\d{1,3}(?!\d+)))+){2,}", RegexOptions.IgnoreCase | RegexOptions.Compiled), //Single episodes with a title (S01E05, 1x05, etc) and trailing info in slashes