Fixed: Limit Raw HD detection by MPEG-2 to HDTV sources

This commit is contained in:
Mark McDowall 2020-10-13 00:06:12 -07:00
parent 4ad137f1eb
commit 19f724dcd9
1 changed files with 9 additions and 2 deletions

View File

@ -31,9 +31,11 @@ namespace NzbDrone.Core.Parser
)(?:\b|$|[ .])", )(?:\b|$|[ .])",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
private static readonly Regex RawHDRegex = new Regex(@"\b(?<rawhd>RawHD|1080i[-_. ]HDTV|Raw[-_. ]HD|MPEG[-_. ]?2)\b", private static readonly Regex RawHDRegex = new Regex(@"\b(?<rawhd>RawHD|1080i[-_. ]HDTV|Raw[-_. ]HD)\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex MPEG2Regex = new Regex(@"\b(?<mpeg2>MPEG[-_. ]?2)\b");
private static readonly Regex ProperRegex = new Regex(@"\b(?<proper>proper)\b", private static readonly Regex ProperRegex = new Regex(@"\b(?<proper>proper)\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
@ -210,6 +212,12 @@ namespace NzbDrone.Core.Parser
if (sourceMatch.Groups["hdtv"].Success) if (sourceMatch.Groups["hdtv"].Success)
{ {
if (MPEG2Regex.IsMatch(normalizedName))
{
result.Quality = Quality.RAWHD;
return result;
}
if (resolution == Resolution.R2160p) if (resolution == Resolution.R2160p)
{ {
result.Quality = Quality.HDTV2160p; result.Quality = Quality.HDTV2160p;
@ -403,7 +411,6 @@ namespace NzbDrone.Core.Parser
} }
} }
if (codecRegex.Groups["x264"].Success) if (codecRegex.Groups["x264"].Success)
{ {
result.Quality = Quality.SDTV; result.Quality = Quality.SDTV;