From d98c86c3d971c403c5fbcf91612b61ee2014a76f Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 24 Nov 2022 10:12:12 -0800 Subject: [PATCH] Fixed: Parse year in title from square brackets (cherry picked from commit 99e60196a4e513d6340a090de4a5517f205e7a29) --- src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs | 1 + src/NzbDrone.Core/Parser/Parser.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index fbc63c404..a8038f4e7 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -215,6 +215,7 @@ public void should_parse_movie_folder_name(string postTitle, string title) [TestCase("Movie Name FRENCH BluRay 720p 2016 kjhlj", 2016)] [TestCase("Der.Movie.German.Bluray.FuckYou.Pso.Why.cant.you.follow.scene.rules.1998", 1998)] [TestCase("Movie Name (1897) [DVD].mp4", 1897)] + [TestCase("World Movie Z Movie [2023]", 2023)] public void should_parse_movie_year(string postTitle, int year) { Parser.Parser.ParseMovieTitle(postTitle).Year.Should().Be(year); diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index f7bdb4775..e56859a7f 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -144,7 +144,7 @@ public static class Parser private static readonly Regex AnimeReleaseGroupRegex = new Regex(@"^(?:\[(?(?!\s).+?(?.+?)(?:\W|_)?(?\d{4})", + private static readonly Regex YearInTitleRegex = new Regex(@"^(?.+?)(?:\W|_.)?[\(\[]?(?<year>\d{4})[\]\)]?", RegexOptions.IgnoreCase | RegexOptions.Compiled); // Handle Exception Release Groups that don't follow -RlsGrp; Manual List