From 25685314bc690560229edc809ba19016ed8a18cc Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 3 Aug 2024 11:28:27 +0300 Subject: [PATCH] Fixed: Parsing alternative titles containing "A.K.A." --- .../ParserTests/ParserFixture.cs | 14 ++++++++++++++ src/NzbDrone.Core/Parser/Parser.cs | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 1c314af76..8283f73a9 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -201,6 +201,20 @@ namespace NzbDrone.Core.Test.ParserTests "Енола Голмс", "Enola Holmes" })] + [TestCase("Mon cousin a.k.a. My Cousin 2020 1080p Blu-ray DD 5.1 x264.mkv", + new string[] + { + "Mon cousin AKA My Cousin", + "Mon cousin", + "My Cousin" + })] + [TestCase("Sydney A.K.A. Hard Eight 1996 1080p AMZN WEB-DL DD+ 2.0 H.264.mkv", + new string[] + { + "Sydney AKA Hard Eight", + "Sydney", + "Hard Eight" + })] public void should_parse_movie_alternative_titles(string postTitle, string[] parsedTitles) { var movieInfo = Parser.Parser.ParseMovieTitle(postTitle, true); diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 718efe892..1b98ae3ea 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -105,6 +105,8 @@ namespace NzbDrone.Core.Parser // Regex to unbracket alternative titles. private static readonly Regex BracketedAlternativeTitleRegex = new Regex(@"(.*) \([ ]*AKA[ ]+(.*)\)", RegexOptions.IgnoreCase | RegexOptions.Compiled); + private static readonly Regex NormalizeAlternativeTitleRegex = new Regex(@"[ ]+(?:A\.K\.A\.)[ ]+", RegexOptions.IgnoreCase | RegexOptions.Compiled); + private static readonly Regex NormalizeRegex = new Regex(@"((?:\b|_)(?