Fixed: Better Parsing of 4k Releases

Fixed: Parse 4k H265 releases as 4k
Fixed: Parse 3840x2160 as 4k

(based on radarr commit fa6b7ad2877a78182823e8bd831d01a70c16f033)
pull/4866/head
bakerboy448 3 years ago committed by Mark McDowall
parent ac9a98e498
commit faa510eb09

@ -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);
}

@ -46,7 +46,7 @@ namespace NzbDrone.Core.Parser
private static readonly Regex RealRegex = new Regex(@"\b(?<real>REAL)\b",
RegexOptions.Compiled);
private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?<R360p>360p)|(?<R480p>480p|640x480|848x480)|(?<R540p>540p)|(?<R576p>576p)|(?<R720p>720p|1280x720|960p)|(?<R1080p>1080p|1920x1080|1440p|FHD|1080i|4kto1080p)|(?<R2160p>2160p|4k[-_. ](?:UHD|HEVC|BD)|(?:UHD|HEVC|BD)[-_. ]4k))\b",
private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?<R360p>360p)|(?<R480p>480p|640x480|848x480)|(?<R540p>540p)|(?<R576p>576p)|(?<R720p>720p|1280x720|960p)|(?<R1080p>1080p|1920x1080|1440p|FHD|1080i|4kto1080p)|(?<R2160p>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;

Loading…
Cancel
Save