From 59516c240f29ab22fe1ff154bc73ad4b6b4c405d Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 15 Feb 2012 12:17:10 -0800 Subject: [PATCH] Fix for episodes with "Part" in the Episode Title being picked up as mini-series releases. --- NzbDrone.Core.Test/ParserTest.cs | 1 + NzbDrone.Core/Parser.cs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/NzbDrone.Core.Test/ParserTest.cs b/NzbDrone.Core.Test/ParserTest.cs index 0aa41a4f9..9415a58c9 100644 --- a/NzbDrone.Core.Test/ParserTest.cs +++ b/NzbDrone.Core.Test/ParserTest.cs @@ -62,6 +62,7 @@ public class ParserTest : CoreTest [TestCase("S6E02-Unwrapped-(Playing With Food) - [DarkData]", "", 6, 2)] [TestCase("S06E03-Unwrapped-(Number Ones Unwrapped) - [DarkData]", "", 6, 3)] [TestCase("The Mentalist S02E21 18 5 4 720p WEB DL DD5 1 h 264 EbP", "The Mentalist", 2, 21)] + [TestCase("01x04 - Halloween, Part 1 - 720p WEB-DL", "", 1, 4)] public void ParseTitle_single(string postTitle, string title, int seasonNumber, int episodeNumber) { var result = Parser.ParseTitle(postTitle); diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs index 04ae8936b..7758a6902 100644 --- a/NzbDrone.Core/Parser.cs +++ b/NzbDrone.Core/Parser.cs @@ -33,10 +33,6 @@ public static class Parser new Regex(@"^(?.+?)(?:\W+S?(?<season>(?<!\d+)\d{1,2}(?!\d+))(?:(?:\-|[ex]|\s[ex]){1,2}(?<episode>\d{2}(?!\d+)))+)\W?(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Mini-Series, treated as season 1, episodes are labeled as Part01, Part 01, Part.1 - new Regex(@"^(?<title>.+?)(?:\W+(?:(?:Part\W?|(?<!\d+\W+)e)(?<episode>\d{1,2}(?!\d+)))+)\W?(?!\\)", - RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Episodes without a title, Single (S01E05, 1x05) AND Multi (S01E04E05, 1x04x05, etc) new Regex(@"^(?:S?(?<season>(?<!\d+)\d{1,2}(?!\d+))(?:(?:\-|[ex])(?<episode>\d{1,2}(?!\d+)))+\W*)+\W?(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), @@ -53,6 +49,10 @@ public static class Parser new Regex(@"^(?<title>.+?)?(?:\W?(?<season>(?<!\d+)\d{1})(?<episode>\d{2}(?!p|i|\d+)))+\W?(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Mini-Series, treated as season 1, episodes are labeled as Part01, Part 01, Part.1 + new Regex(@"^(?<title>.+?)(?:\W+(?:(?:Part\W?|(?<!\d+\W+)e)(?<episode>\d{1,2}(?!\d+)))+)\W?(?!\\)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Supports Season only releases new Regex(@"^(?<title>.+?)\W(?:S|Season)\W?(?<season>\d{1,2}(?!\d+))\W?(?<extras>EXTRAS|SUBPACK)?(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled)