diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 578592956..1fb66cb8c 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -35,7 +35,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Hawaii Five 0", "hawaiifive0")] [TestCase("Match of the Day", "matchday")] [TestCase("Match of the Day 2", "matchday2")] - public void should_parse_series_name(string postTitle, string title) + public void should_parse_series_name(String postTitle, String title) { var result = Parser.Parser.ParseSeriesName(postTitle); result.Should().Be(title.CleanSeriesTitle()); @@ -48,5 +48,11 @@ namespace NzbDrone.Core.Test.ParserTests title.CleanSeriesTitle().Should().Be("carnivale"); } + + [TestCase("[scnzbefnet][509103] 2.Broke.Girls.S03E18.720p.HDTV.X264-DIMENSION", "2 Broke Girls")] + public void should_remove_request_info_from_title(String postTitle, String title) + { + Parser.Parser.ParseTitle(postTitle).SeriesTitle.Should().Be(title.CleanSeriesTitle()); + } } } diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index d1306ae51..f21c2843e 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -153,6 +153,8 @@ namespace NzbDrone.Core.Parser private static readonly Regex SpecialEpisodeWordRegex = new Regex(@"\b(part|special|edition)\b\s?", RegexOptions.IgnoreCase | RegexOptions.Compiled); + private static readonly Regex RequestInfoRegex = new Regex(@"\[.+?\]", RegexOptions.Compiled); + public static ParsedEpisodeInfo ParsePath(string path) { var fileInfo = new FileInfo(path); @@ -381,6 +383,7 @@ namespace NzbDrone.Core.Parser private static ParsedEpisodeInfo ParseMatchCollection(MatchCollection matchCollection) { var seriesName = matchCollection[0].Groups["title"].Value.Replace('.', ' '); + seriesName = RequestInfoRegex.Replace(seriesName, "").Trim(' '); int airYear; Int32.TryParse(matchCollection[0].Groups["airyear"].Value, out airYear);