From 97ff5090254548e392ea0754124dcaf1f7bb6a2f Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 31 May 2020 22:19:18 -0400 Subject: [PATCH] Fixed: Recognize 8 Digit IMDB in parsing/rss lists Fixes #3637 --- src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs | 8 ++++++++ src/NzbDrone.Core/Parser/Parser.cs | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 3e66008db..02589c01c 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -129,6 +129,14 @@ namespace NzbDrone.Core.Test.ParserTests parsed.Languages.First().Should().Be(Language.English); } + [TestCase("The Italian Job 2008 [tt1234567] 720p BluRay X264", "tt1234567")] + [TestCase("The Italian Job 2008 [tt12345678] 720p BluRay X264", "tt12345678")] + public void should_parse_imdb_in_title(string postTitle, string imdb) + { + var parsed = Parser.Parser.ParseMovieTitle(postTitle, true); + parsed.ImdbId.Should().Be(imdb); + } + [TestCase("123", "tt0000123")] [TestCase("1234567", "tt1234567")] [TestCase("tt1234567", "tt1234567")] diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 896b0139b..b2e3fee8f 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -90,7 +90,7 @@ namespace NzbDrone.Core.Parser private static readonly Regex FileExtensionRegex = new Regex(@"\.[a-z0-9]{2,4}$", RegexOptions.IgnoreCase | RegexOptions.Compiled); - private static readonly Regex ReportImdbId = new Regex(@"(?tt\d{7})", RegexOptions.IgnoreCase | RegexOptions.Compiled); + private static readonly Regex ReportImdbId = new Regex(@"(?tt\d{7,8})", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly RegexReplace SimpleTitleRegex = new RegexReplace(@"\s*(?:480[ip]|576[ip]|720[ip]|1080[ip]|2160[ip]|[xh][\W_]?26[45]|DD\W?5\W1|[<>?*:|]|848x480|1280x720|1920x1080|(8|10)b(it)?)", string.Empty, @@ -309,7 +309,7 @@ namespace NzbDrone.Core.Parser { if (match.Groups["imdbid"].Value != null) { - if (match.Groups["imdbid"].Length == 9) + if (match.Groups["imdbid"].Length == 9 || match.Groups["imdbid"].Length == 10) { return match.Groups["imdbid"].Value; }