From 7836246b05aa5778bae4005eb5d082e86fb8c3fd Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Tue, 12 Jan 2021 12:37:40 -0600 Subject: [PATCH] Fixed: Parse standalone UHD as 4K if no other resolution info is present --- .../ParserTests/QualityParserFixture.cs | 11 +++++++++++ src/NzbDrone.Core/Parser/QualityParser.cs | 10 ++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index 6e9a081de..e6254a27c 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -241,11 +241,21 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("John.Carpenter.Live.Retrospective.2016.2018.1080p.MBluRay.x264-CRUELTY.mkv", false)] [TestCase("Heart.Live.In.Atlantic.City.2019.1080p.MBLURAY.x264-MBLURAYFANS.mkv", false)] [TestCase("Opeth.Garden.Of.The.Titans.Live.At.Red.Rocks.Amphitheatre.2017.1080p.MBluRay.x264-TREBLE.mkv", false)] + [TestCase("Rise.Of.The.Planet.Of.The.Apes.2011.UHD.BluRay.DD5.1.HDR.x265-CtrlHD/ctrlhd-rotpota-1080p.mkv", false)] + [TestCase("V for Vendetta 2005 1080p UHD BluRay DD+7.1 x264-LoRD.mkv", false)] + [TestCase("Rise.Of.The.Planet.Of.The.Apes.2011.1080p.UHD.BluRay.DD5.1.HDR.x265-CtrlHD.mkv", false)] public void should_parse_bluray1080p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Source.BLURAY, proper, Resolution.R1080p); } + [TestCase("Rise.Of.The.Planet.Of.The.Apes.2011.2160p.UHD.BluRay.DD5.1.HDR.x265-CtrlHD.mkv", false)] + [TestCase("X-Men.Days.of.Future.Past.2014.2160p.UHD.BluRay.X265-IAMABLE.mkv", false)] + public void should_parse_bluray2160p_quality(string title, bool proper) + { + ParseAndVerifyQuality(title, Source.BLURAY, proper, Resolution.R2160p); + } + [TestCase("Movie.Name.2004.576p.BDRip.x264-HANDJOB")] [TestCase("Hannibal.S01E05.576p.BluRay.DD5.1.x264-HiSD")] public void should_parse_bluray576p_quality(string title) @@ -267,6 +277,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("27.Dresses.2008.REMUX.2160p.Bluray.AVC.DTS-HR.MA.5.1-LEGi0N")] [TestCase("The.Shining.1980.2160p.UHD.BluRay.Remux.HDR.HEVC.DTS-HD.MA.5.1-PmP.mkv")] [TestCase("Stranger.Things.2016.T1.UHDRemux.2160p.HEVC.Dual.AC3.5.1-TrueHD.5.1.Sub")] + [TestCase("[Dolby Vision] Game.of.Thrones.S07.MULTi.UHD.BLURAY.REMUX.DV-NoTag")] public void should_parse_remux2160p_quality(string title) { ParseAndVerifyQuality(title, Source.BLURAY, false, Resolution.R2160p, Modifier.REMUX); diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 08050cc00..566be6bfc 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -59,6 +59,10 @@ namespace NzbDrone.Core.Parser private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?360p)|(?480p|640x480|848x480)|(?576p)|(?720p|1280x720)|(?1080p|1920x1080|1440p|FHD|1080i|4kto1080p)|(?2160p|4k[-_. ](?:UHD|HEVC|BD)|(?:UHD|HEVC|BD)[-_. ]4k))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); + //Handle cases where no resolution is in the release name; assume if UHD then 4k + private static readonly Regex ImpliedResolutionRegex = new Regex(@"\b(?UHD)\b", + RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex CodecRegex = new Regex(@"\b(?:(?x264)|(?h264)|(?XvidHD)|(?X-?vid)|(?divx))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); @@ -599,7 +603,9 @@ namespace NzbDrone.Core.Parser { var match = ResolutionRegex.Match(name); - if (!match.Success) + var matchimplied = ImpliedResolutionRegex.Match(name); + + if (!match.Success & !matchimplied.Success) { return Resolution.Unknown; } @@ -629,7 +635,7 @@ namespace NzbDrone.Core.Parser return Resolution.R1080p; } - if (match.Groups["R2160p"].Success) + if (match.Groups["R2160p"].Success || matchimplied.Groups["R2160p"].Success) { return Resolution.R2160p; }