From 1134d925f4001b940e488ffacf056ef544595dde Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 24 Oct 2011 23:14:55 -0700 Subject: [PATCH] Fixed REGEX for title parsing. --- NzbDrone.Core.Test/ParserTest.cs | 2 ++ NzbDrone.Core/Parser.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Core.Test/ParserTest.cs b/NzbDrone.Core.Test/ParserTest.cs index 19a062476..2fdebd73e 100644 --- a/NzbDrone.Core.Test/ParserTest.cs +++ b/NzbDrone.Core.Test/ParserTest.cs @@ -48,6 +48,7 @@ public class ParserTest : TestBase [TestCase("The Mentalist - S02E21 - 18-5-4", "The Mentalist", 2, 21)] [TestCase("Breaking.In.S01E07.21.0.Jump.Street.720p.WEB-DL.DD5.1.h.264-KiNGS", "Breaking In", 1, 7)] [TestCase("CSI525", "CSI", 5, 25)] + [TestCase("King of the Hill - 10x12 - 24 Hour Propane People [SDTV]", "King of the Hill", 10, 12)] public void ParseTitle_single(string postTitle, string title, int seasonNumber, int episodeNumber) { var result = Parser.ParseTitle(postTitle); @@ -66,6 +67,7 @@ public void ParseTitle_single(string postTitle, string title, int seasonNumber, [TestCase("C:/Test/TV/Chuck.4x05.HDTV.XviD-LOL", 4, 5)] [TestCase(@"P:\TV Shows\House\Season 6\S06E13 - 5 to 9 - 720p BluRay.mkv", 6, 13)] [TestCase(@"S:\TV Drop\House - 10x11 - Title [SDTV]\1011 - Title.avi", 10, 11)] + [TestCase(@"S:\TV Drop\King of the Hill - 10x12 - 24 Hour Propane People [SDTV]\1012 - 24 Hour Propane People.avi", 10, 12)] public void PathParse_tests(string path, int season, int episode) { var result = Parser.ParsePath(path); diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs index 64cc16c58..3e230f5dd 100644 --- a/NzbDrone.Core/Parser.cs +++ b/NzbDrone.Core/Parser.cs @@ -36,7 +36,7 @@ public static class Parser RegexOptions.IgnoreCase | RegexOptions.Compiled), //Episodes over 99 (3-digits or more) - new Regex(@"^(?.*?)(?:\W?S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|[ex]|\s)+(?<episode>\d+))+)+\W?(?!\\)", + new Regex(@"^(?<title>.*?)(?:\W?S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|[ex]|\s){1,2}(?<episode>\d+))+)+\W?(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), //Supports 1103/1113 naming