From 58e81a916ca160abe981b3d613edaa2a5addf283 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sat, 6 May 2017 15:26:35 +0200 Subject: [PATCH] Fixed error when language is present in title, but has dots instead of spaces. For example The.Danish.Girl.2015 --- src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs | 1 + src/NzbDrone.Core/Parser/Parser.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index c7a5e939b..1feea9f4d 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -88,6 +88,7 @@ namespace NzbDrone.Core.Test.ParserTests } [TestCase("The Danish Girl 2015")] + [TestCase("The.Danish.Girl.2015.1080p.BluRay.x264.DTS-HD.MA.5.1-RARBG")] public void should_not_parse_language_in_movie_title(string postTitle) { Parser.Parser.ParseMovieTitle(postTitle).Language.Should().Be(Language.English); diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 237ff1471..e9504fd96 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -412,9 +412,9 @@ namespace NzbDrone.Core.Parser if (result != null) { var languageTitle = simpleTitle; - if (result.MovieTitle.IsNotNullOrWhiteSpace() ) + if (match[0].Groups["title"].Success && match[0].Groups["title"].Value.IsNotNullOrWhiteSpace()) { - languageTitle = simpleTitle.Replace(result.MovieTitle, "A Movie"); + languageTitle = simpleTitle.Replace(match[0].Groups["title"].Value, "A Movie"); } result.Language = LanguageParser.ParseLanguage(languageTitle);