1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-28 08:58:41 +02:00

Fixed: Better Parsing of 4k Releases

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

(based on radarr commit fa6b7ad2877a78182823e8bd831d01a70c16f033)
This commit is contained in:
bakerboy448 2021-08-11 17:38:53 -05:00 committed by Mark McDowall
parent ac9a98e498
commit faa510eb09
2 changed files with 7 additions and 6 deletions

View File

@ -265,6 +265,7 @@ public void should_parse_webrip1080p_quality(string title, bool proper)
[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 @@ public void should_parse_quality_from_other_source(string qualityString, Quality
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);
}

View File

@ -46,7 +46,7 @@ public class QualityParser
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 @@ public static QualityModel ParseQualityName(string name)
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 @@ public static QualityModel ParseQualityName(string name)
if (normalizedName.ContainsIgnoreCase("1280x720"))
{
result.ResolutionDetectionSource = QualityDetectionSource.Name;
if (normalizedName.ContainsIgnoreCase("bluray"))
{
result.SourceDetectionSource = QualityDetectionSource.Name;
@ -504,7 +504,7 @@ public static QualityModel ParseQualityName(string name)
if (normalizedName.ContainsIgnoreCase("1920x1080"))
{
result.ResolutionDetectionSource = QualityDetectionSource.Name;
if (normalizedName.ContainsIgnoreCase("bluray"))
{
result.SourceDetectionSource = QualityDetectionSource.Name;