1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

New: Parsing of 4K GM-TEAM releases

This commit is contained in:
Mark McDowall 2022-12-06 23:10:25 -08:00
parent 4ca5a213fa
commit 9e6b32ca3e
2 changed files with 6 additions and 6 deletions

View File

@ -172,6 +172,7 @@ public void should_parse_hdtv1080p_quality(string title, bool proper)
[TestCase("My Title - S01E01 - EpTitle [HEVC 4k DTSHD-MA-6ch]", false)] [TestCase("My Title - S01E01 - EpTitle [HEVC 4k DTSHD-MA-6ch]", false)]
[TestCase("My Title - S01E01 - EpTitle [HEVC-4k DTSHD-MA-6ch]", false)] [TestCase("My Title - S01E01 - EpTitle [HEVC-4k DTSHD-MA-6ch]", false)]
[TestCase("My Title - S01E01 - EpTitle [4k HEVC DTSHD-MA-6ch]", false)] [TestCase("My Title - S01E01 - EpTitle [4k HEVC DTSHD-MA-6ch]", false)]
[TestCase("[GM-Team][][][Series Title][2022][19][HEVC][GB][4K]", false)]
public void should_parse_hdtv2160p_quality(string title, bool proper) public void should_parse_hdtv2160p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Quality.HDTV2160p, proper); ParseAndVerifyQuality(title, Quality.HDTV2160p, proper);

View File

@ -49,8 +49,8 @@ public class QualityParser
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", 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); RegexOptions.Compiled | RegexOptions.IgnoreCase);
// Handle cases where no resolution is in the release name; assume if UHD then 4k // Handle cases where no resolution is in the release name (assume if UHD then 4k) or resolution is non-standard
private static readonly Regex ImpliedResolutionRegex = new Regex(@"\b(?<R2160p>UHD)\b", private static readonly Regex AlternativeResolutionRegex = new Regex(@"\b(?<R2160p>UHD)\b|(?<R2160p>\[4K\])",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex CodecRegex = new Regex(@"\b(?:(?<x264>x264)|(?<h264>h264)|(?<xvidhd>XvidHD)|(?<xvid>Xvid)|(?<divx>divx))\b", private static readonly Regex CodecRegex = new Regex(@"\b(?:(?<x264>x264)|(?<h264>h264)|(?<xvidhd>XvidHD)|(?<xvid>Xvid)|(?<divx>divx))\b",
@ -558,10 +558,9 @@ public static QualityModel ParseQualityName(string name)
private static Resolution ParseResolution(string name) private static Resolution ParseResolution(string name)
{ {
var match = ResolutionRegex.Match(name); var match = ResolutionRegex.Match(name);
var alternativeMatch = AlternativeResolutionRegex.Match(name);
var matchimplied = ImpliedResolutionRegex.Match(name); if (!match.Success & !alternativeMatch.Success)
if (!match.Success & !matchimplied.Success)
{ {
return Resolution.Unknown; return Resolution.Unknown;
} }
@ -601,7 +600,7 @@ private static Resolution ParseResolution(string name)
return Resolution.R2160p; return Resolution.R2160p;
} }
if (matchimplied.Groups["R2160p"].Success) if (alternativeMatch.Groups["R2160p"].Success)
{ {
return Resolution.R2160p; return Resolution.R2160p;
} }