From faa510eb0916d5a705584e2db66e3d286e4f637c Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Wed, 11 Aug 2021 17:38:53 -0500 Subject: [PATCH] Fixed: Better Parsing of 4k Releases Fixed: Parse 4k H265 releases as 4k Fixed: Parse 3840x2160 as 4k (based on radarr commit fa6b7ad2877a78182823e8bd831d01a70c16f033) --- .../ParserTests/QualityParserFixture.cs | 3 ++- src/NzbDrone.Core/Parser/QualityParser.cs | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index ffa878e0b..320ea18b0 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -265,6 +265,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("House.of.Sonarr.AK.s05e13.4K.UHD.WEB.DL", false)] [TestCase("House.of.Sonarr.AK.s05e13.UHD.4K.WEB.DL", false)] [TestCase("[HorribleSubs] Series Title! S01 [Web][MKV][h264][2160p][AAC 2.0][Softsubs (HorribleSubs)]", false)] + [TestCase("Series Title S02 2013 WEB-DL 4k H265 AAC 2Audio-HDSWEB", false)] public void should_parse_webdl2160p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Quality.WEBDL2160p, proper); @@ -404,7 +405,7 @@ namespace NzbDrone.Core.Test.ParserTests public void should_parse_full_quality_from_name(string title) { var result = QualityParser.ParseQuality(title); - + result.SourceDetectionSource.Should().Be(QualityDetectionSource.Name); result.ResolutionDetectionSource.Should().Be(QualityDetectionSource.Name); } diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index bca5079ca..ed152093c 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -46,7 +46,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(?:(?360p)|(?480p|640x480|848x480)|(?540p)|(?576p)|(?720p|1280x720|960p)|(?1080p|1920x1080|1440p|FHD|1080i|4kto1080p)|(?2160p|4k[-_. ](?:UHD|HEVC|BD)|(?:UHD|HEVC|BD)[-_. ]4k))\b", + private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?360p)|(?480p|640x480|848x480)|(?540p)|(?576p)|(?720p|1280x720|960p)|(?1080p|1920x1080|1440p|FHD|1080i|4kto1080p)|(?2160p|3840x2160|4k[-_. ](?:UHD|HEVC|BD|H265)|(?:UHD|HEVC|BD|H265)[-_. ]4k))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); @@ -458,14 +458,14 @@ namespace NzbDrone.Core.Parser if (codecRegex.Groups["x264"].Success) { result.Quality = Quality.SDTV; - + return result; } if (normalizedName.Contains("848x480")) { result.ResolutionDetectionSource = QualityDetectionSource.Name; - + if (normalizedName.Contains("dvd")) { result.SourceDetectionSource = QualityDetectionSource.Name; @@ -487,7 +487,7 @@ namespace NzbDrone.Core.Parser if (normalizedName.ContainsIgnoreCase("1280x720")) { result.ResolutionDetectionSource = QualityDetectionSource.Name; - + if (normalizedName.ContainsIgnoreCase("bluray")) { result.SourceDetectionSource = QualityDetectionSource.Name; @@ -504,7 +504,7 @@ namespace NzbDrone.Core.Parser if (normalizedName.ContainsIgnoreCase("1920x1080")) { result.ResolutionDetectionSource = QualityDetectionSource.Name; - + if (normalizedName.ContainsIgnoreCase("bluray")) { result.SourceDetectionSource = QualityDetectionSource.Name;