Fixed: Parsing alternative titles containing "A.K.A."

pull/10296/head
Bogdan 3 months ago
parent 41b1ea553e
commit 25685314bc

@ -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);

@ -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|_)(?<!^|[^a-zA-Z0-9_']\w[^a-zA-Z0-9_'])(a(?!$|[^a-zA-Z0-9_']\w[^a-zA-Z0-9_'])|an|the|and|or|of)(?!$)(?:\b|_))|\W|_",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
@ -590,6 +592,7 @@ namespace NzbDrone.Core.Parser
}
var movieName = matchCollection[0].Groups["title"].Value.Replace('_', ' ');
movieName = NormalizeAlternativeTitleRegex.Replace(movieName, " AKA ");
movieName = RequestInfoRegex.Replace(movieName, "").Trim(' ');
var parts = movieName.Split('.');

Loading…
Cancel
Save