From 8c211364e22736bdcca02800f1a2a6fa2aeba5b6 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 8 Dec 2015 15:26:52 -0800 Subject: [PATCH] Fixed: Improved parsing of some multi-episode filenames --- .../ParserTests/MultiEpisodeParserFixture.cs | 2 ++ .../ParserTests/SingleEpisodeParserFixture.cs | 2 ++ src/NzbDrone.Core/Parser/Parser.cs | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs index 51bdb6207..5240fe0d2 100644 --- a/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/MultiEpisodeParserFixture.cs @@ -43,6 +43,8 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("The Young And The Restless - S42 Ep10718 - Ep10722", "The Young And The Restless", 42, new[] { 10718, 10719, 10720, 10721, 10722 })] [TestCase("The Young And The Restless - S42 Ep10688 - Ep10692", "The Young And The Restless", 42, new[] { 10688, 10689, 10690, 10691, 10692 })] [TestCase("RWBY.S01E02E03.1080p.BluRay.x264-DeBTViD", "RWBY", 1, new [] { 2, 3 })] + [TestCase("grp-zoos01e11e12-1080p", "grp-zoo", 1, new [] { 11, 12 })] + [TestCase("grp-zoo-s01e11e12-1080p", "grp-zoo", 1, new [] { 11, 12 })] //[TestCase("", "", , new [] { })] public void should_parse_multiple_episodes(string postTitle, string title, int season, int[] episodes) { diff --git a/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs index a6b5be997..9deff5df3 100644 --- a/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs @@ -114,6 +114,8 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("quantico.103.hdtv-lol[ettv].mp4", "quantico", 1, 3)] [TestCase("Fargo - 01x02 - The Rooster Prince - [itz_theo]", "Fargo", 1, 2)] [TestCase("Castle (2009) - [06x16] - Room 147.mp4", "Castle (2009)", 6, 16)] + [TestCase("grp-zoos01e11-1080p", "grp-zoo", 1, 11)] + [TestCase("grp-zoo-s01e11-1080p", "grp-zoo", 1, 11)] //[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 6097cb3f0..107552049 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -82,6 +82,10 @@ namespace NzbDrone.Core.Parser new Regex(@"(?:.*(?:\""|^))(?.*?)(?:[-_\W](?<![()\[]))+(?:\W?Season\W?)(?<season>(?<!\d+)\d{1,2}(?!\d+))(?:\W|_)+(?:Episode\W)(?:[-_. ]?(?<episode>(?<!\d+)\d{1,2}(?!\d+)))+", RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Multi-episode release with no space between series title and season (S01E11E12) + new Regex(@"(?:.*(?:^))(?<title>.*?)(?:\W?|_)S(?<season>(?<!\d+)\d{2}(?!\d+))(?:E(?<episode>(?<!\d+)\d{2}(?!\d+)))+", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Single episode season or episode S1E1 or S1-E1 new Regex(@"(?:.*(?:\""|^))(?<title>.*?)(?:\W?|_)S(?<season>(?<!\d+)\d{1,2}(?!\d+))(?:\W|_)?E(?<episode>(?<!\d+)\d{1,2}(?!\d+))", RegexOptions.IgnoreCase | RegexOptions.Compiled),