From e5cb8bb0bd22aa32de247c25cc5a61d320568ecc Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 25 Mar 2016 19:13:24 -0700 Subject: [PATCH] Fixed: Some releases with date and season/episode numbers with multiple episodes on a single day Closes #1192 --- .../ParserTests/DailyEpisodeParserFixture.cs | 1 - .../ParserTests/SingleEpisodeParserFixture.cs | 2 ++ src/NzbDrone.Core/Parser/Parser.cs | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/DailyEpisodeParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/DailyEpisodeParserFixture.cs index 33b57a267..47a4ac6d8 100644 --- a/src/NzbDrone.Core.Test/ParserTests/DailyEpisodeParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/DailyEpisodeParserFixture.cs @@ -28,7 +28,6 @@ public class DailyEpisodeParserFixture : CoreTest [TestCase("At_Midnight_140722_720p_HDTV_x264-YesTV", "At Midnight", 2014, 07, 22)] //[TestCase("Corrie.07.01.15", "Corrie", 2015, 1, 7)] [TestCase("The Nightly Show with Larry Wilmore 2015 02 09 WEBRIP s01e13", "The Nightly Show with Larry Wilmore", 2015, 2, 9)] - [TestCase("Judge Judy 2016 02 10 S20E121", "Judge Judy", 2016, 2, 10)] //[TestCase("", "", 0, 0, 0)] public void should_parse_daily_episode(string postTitle, string title, int year, int month, int day) { diff --git a/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs index 037dae126..ec1c5ddf3 100644 --- a/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs @@ -118,6 +118,8 @@ public class SingleEpisodeParserFixture : CoreTest [TestCase("grp-zoo-s01e11-1080p", "grp-zoo", 1, 11)] [TestCase("Jeopardy!.S2016E14.2016-01-20.avi", "Jeopardy!", 2016, 14)] [TestCase("Ken.Burns.The.Civil.War.5of9.The.Universe.Of.Battle.1990.DVDRip.x264-HANDJOB", "Ken Burns The Civil War", 1, 5)] + [TestCase("Judge Judy 2016 02 25 S20E142", "Judge Judy", 20, 142)] + [TestCase("Judge Judy 2016 02 25 S20E143", "Judge Judy", 20, 143)] //[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 c92fd5463..649c526e0 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -62,6 +62,10 @@ public static class Parser new Regex(@"^(?.+?)(?:(?:_|-|\s|\.)+(?<absoluteepisode>\d{2,3}(?!\d+)))+(?:[-_. ]+(?<special>special|ova|ovd))?[-_. ]+.*?(?<hash>\[\w{8}\])(?:$|\.)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Episodes with airdate AND season/episode number, capture season/epsiode only + new Regex(@"^(?<title>.+?)?\W*(?<airdate>\d{4}\W+[0-1][0-9]\W+[0-3][0-9])(?!\W+[0-3][0-9])[-_. ](?:s?(?<season>(?<!\d+)(?:\d{1,2})(?!\d+)))(?:[ex](?<episode>(?<!\d+)(?:\d{1,3})(?!\d+)))", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Episodes with airdate AND season/episode number new Regex(@"^(?<title>.+?)?\W*(?<airyear>\d{4})\W+(?<airmonth>[0-1][0-9])\W+(?<airday>[0-3][0-9])(?!\W+[0-3][0-9]).+?(?:s?(?<season>(?<!\d+)(?:\d{1,2})(?!\d+)))(?:[ex](?<episode>(?<!\d+)(?:\d{1,3})(?!\d+)))", RegexOptions.IgnoreCase | RegexOptions.Compiled),