mirror of
https://github.com/Radarr/Radarr.git
synced 2025-04-18 19:54:44 -04:00
New: Parsing releases with 4K in square brackets as 2160p
(cherry picked from commit 9e6b32ca3ec1f16e54803f6419365b1c68ea18e0) Closes #7848
This commit is contained in:
parent
e03289abe7
commit
78c009d6fa
2 changed files with 12 additions and 7 deletions
|
@ -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)]
|
||||
|
|
|
@ -59,9 +59,9 @@ namespace NzbDrone.Core.Parser
|
|||
private static readonly Regex ResolutionRegex = new (@"\b(?:(?<R360p>360p)|(?<R480p>480p|480i|640x480|848x480)|(?<R540p>540p)|(?<R576p>576p)|(?<R720p>720p|1280x720|960p)|(?<R1080p>1080p|1920x1080|1440p|FHD|1080i|4kto1080p)|(?<R2160p>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(?<R2160p>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(?<R2160p>UHD)\b|(?<R2160p>\[4K\])",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static readonly Regex CodecRegex = new (@"\b(?:(?<x264>x264)|(?<h264>h264)|(?<xvidhd>XvidHD)|(?<xvid>X-?vid)|(?<divx>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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue