From b8b0f05920485dbedc2e0979d58007599550e793 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 17 Aug 2017 21:53:22 -0700 Subject: [PATCH] Fixed: Parsing 4k UHD as 2160p Closes #2127 --- .../ParserTests/QualityParserFixture.cs | 9 +++++++++ src/NzbDrone.Core/Parser/QualityParser.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index e5a187c5c..7bd4a6a2d 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -178,6 +178,8 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.x264-spamTV", false)] [TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.h264-spamTV", false)] [TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.PROPER.h264-spamTV", true)] + [TestCase("House.of.Cards.US.s05e13.4K.UHD.WEB.DL", false)] + [TestCase("House.of.Cards.US.s05e13.UHD.4K.WEB.DL", false)] public void should_parse_webdl2160p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Quality.WEBDL2160p, proper); @@ -215,6 +217,13 @@ namespace NzbDrone.Core.Test.ParserTests ParseAndVerifyQuality(title, Quality.Bluray1080p, proper); } + [TestCase("House.of.Cards.US.s05e13.4K.UHD.Bluray", false)] + [TestCase("House.of.Cards.US.s05e13.UHD.4K.Bluray", false)] + public void should_parse_bluray2160p_quality(string title, bool proper) + { + ParseAndVerifyQuality(title, Quality.Bluray2160p, proper); + } + [TestCase("POI S02E11 1080i HDTV DD5.1 MPEG2-TrollHD", false)] [TestCase("How I Met Your Mother S01E18 Nothing Good Happens After 2 A.M. 720p HDTV DD5.1 MPEG2-TrollHD", false)] [TestCase("The Voice S01E11 The Finals 1080i HDTV DD5.1 MPEG2-TrollHD", false)] diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 7154cd3fd..c650eee2a 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -40,7 +40,7 @@ namespace NzbDrone.Core.Parser private static readonly Regex RealRegex = new Regex(@"\b(?REAL)\b", RegexOptions.Compiled); - private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?480p|640x480|848x480)|(?576p)|(?720p|1280x720)|(?1080p|1920x1080)|(?2160p))\b", + private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?480p|640x480|848x480)|(?576p)|(?720p|1280x720)|(?1080p|1920x1080)|(?2160p|4k[-_. ]UHD|UHD[-_. ]4k))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex CodecRegex = new Regex(@"\b(?:(?x264)|(?h264)|(?XvidHD)|(?Xvid)|(?divx))\b",