From 4d8a270170c7c8bf6b4a61deef7c94320e0878c5 Mon Sep 17 00:00:00 2001 From: MangaValk Date: Sat, 19 Aug 2017 00:24:41 +0200 Subject: [PATCH] Fixed: Parser error when using `(year) name` folder (#1956) (Fixes #1951) --- src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs | 12 +++++++++--- src/NzbDrone.Core/Parser/Parser.cs | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 94cd22956..40f78581e 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -86,10 +86,16 @@ public void should_remove_request_info_from_title(string postTitle, string title [TestCase("My Movie 1999 German Bluray", "My Movie")] public void should_parse_movie_title(string postTitle, string title) { - Parser.Parser.ParseMovieTitle(postTitle, true).MovieTitle.Should().Be(title); - } + Parser.Parser.ParseMovieTitle(postTitle, true).MovieTitle.Should().Be(title); + } - [TestCase("1941.1979.EXTENDED.720p.BluRay.X264-AMIABLE", 1979)] + [TestCase("(1995) Ghost in the Shell", "Ghost in the Shell")] + public void should_parse_movie_folder_name(string postTitle, string title) + { + Parser.Parser.ParseMovieTitle(postTitle, true, true).MovieTitle.Should().Be(title); + } + + [TestCase("1941.1979.EXTENDED.720p.BluRay.X264-AMIABLE", 1979)] [TestCase("Valana la Legende FRENCH BluRay 720p 2016 kjhlj", 2016)] [TestCase("Der.Soldat.James.German.Bluray.FuckYou.Pso.Why.cant.you.follow.scene.rules.1998", 1998)] public void should_parse_movie_year(string postTitle, int year) diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 0abd6ba3e..be7d1a28f 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -848,7 +848,7 @@ private static SeriesTitleInfo GetSeriesTitleInfo(string title) private static ParsedMovieInfo ParseMovieMatchCollection(MatchCollection matchCollection) { - if (!matchCollection[0].Groups["title"].Success) + if (!matchCollection[0].Groups["title"].Success || matchCollection[0].Groups["title"].Value == "(") { return null; }