diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index c1f399b26c..851995ed3a 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -150,6 +150,12 @@ namespace NzbDrone.Core.Test.ParserTests ParseAndVerifyQuality(title, QualitySource.TV, proper, Resolution.R1080p); } + [TestCase("[NOGRP][国漫][诛仙][Movie Title 2022][19][HEVC][GB][4K]", false)] + public void should_parse_hdtv2160p_quality(string title, bool proper) + { + ParseAndVerifyQuality(title, QualitySource.TV, proper, Resolution.R2160p); + } + [TestCase("Movie Name S01E04 Mexicos Death Train 720p WEB DL", false)] [TestCase("Movie Name S02E21 720p WEB DL DD5 1 H 264", false)] [TestCase("Movie Name S04E22 720p WEB DL DD5 1 H 264 NFHD", false)] diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 35da899335..28b24fa1a8 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -59,9 +59,9 @@ namespace NzbDrone.Core.Parser private static readonly Regex ResolutionRegex = new (@"\b(?:(?360p)|(?480p|480i|640x480|848x480)|(?540p)|(?576p)|(?720p|1280x720|960p)|(?1080p|1920x1080|1440p|FHD|1080i|4kto1080p)|(?2160p|3840x2160|4k[-_. ](?:UHD|HEVC|BD|H\.?265)|(?:UHD|HEVC|BD|H\.?265)[-_. ]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 (@"\b(?UHD)\b", - RegexOptions.Compiled | RegexOptions.IgnoreCase); + // Handle cases where no resolution is in the release name (assume if UHD then 4k) or resolution is non-standard + private static readonly Regex AlternativeResolutionRegex = new (@"\b(?UHD)\b|(?\[4K\])", + RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex CodecRegex = new (@"\b(?:(?x264)|(?h264)|(?XvidHD)|(?X-?vid)|(?divx))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); @@ -669,10 +669,9 @@ namespace NzbDrone.Core.Parser private static Resolution ParseResolution(string name) { var match = ResolutionRegex.Match(name); + var alternativeMatch = AlternativeResolutionRegex.Match(name); - var matchimplied = ImpliedResolutionRegex.Match(name); - - if (!match.Success & !matchimplied.Success) + if (!match.Success & !alternativeMatch.Success) { return Resolution.Unknown; } @@ -707,7 +706,7 @@ namespace NzbDrone.Core.Parser return Resolution.R1080p; } - if (match.Groups["R2160p"].Success || matchimplied.Groups["R2160p"].Success) + if (match.Groups["R2160p"].Success || alternativeMatch.Groups["R2160p"].Success) { return Resolution.R2160p; }