mirror of
https://github.com/Radarr/Radarr
synced 2025-12-31 20:55:25 +01:00
Fixed: Enable parsing of repacks with revision
Closes #8060 Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
a0068a3ed9
commit
b44f050246
2 changed files with 25 additions and 23 deletions
|
|
@ -453,14 +453,16 @@ public void should_parse_resolution_from_name_and_source_from_extension(string t
|
|||
result.ResolutionDetectionSource.Should().Be(QualityDetectionSource.Name);
|
||||
}
|
||||
|
||||
[TestCase("Movie Title 2018 REPACK 720p x264 aAF", true)]
|
||||
[TestCase("Movie.Title.2018.REPACK.720p.x264-aAF", true)]
|
||||
[TestCase("Movie.Title.2018.PROPER.720p.x264-aAF", false)]
|
||||
[TestCase("Movie.Title.2018.RERIP.720p.BluRay.x264-DEMAND", true)]
|
||||
public void should_be_able_to_parse_repack(string title, bool isRepack)
|
||||
[TestCase("Movie Title 2018 REPACK 720p HDTV x264 aAF", true, 2)]
|
||||
[TestCase("Movie.Title.2018.REPACK.720p.HDTV.x264-aAF", true, 2)]
|
||||
[TestCase("Movie.Title.2018.REPACK2.720p.HDTV.x264-aAF", true, 3)]
|
||||
[TestCase("Movie.Title.2018.PROPER.720p.HDTV.x264-aAF", false, 2)]
|
||||
[TestCase("Movie.Title.2018.RERIP.720p.BluRay.x264-DEMAND", true, 2)]
|
||||
[TestCase("Movie.Title.2018.RERIP2.720p.BluRay.x264-DEMAND", true, 3)]
|
||||
public void should_be_able_to_parse_repack(string title, bool isRepack, int version)
|
||||
{
|
||||
var result = QualityParser.ParseQuality(title);
|
||||
result.Revision.Version.Should().Be(2);
|
||||
result.Revision.Version.Should().Be(version);
|
||||
result.Revision.IsRepack.Should().Be(isRepack);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ public class QualityParser
|
|||
private static readonly Regex ProperRegex = new (@"\b(?<proper>proper)\b",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static readonly Regex RepackRegex = new (@"\b(?<repack>repack|rerip)\b",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex RepackRegex = new (@"\b(?<repack>repack\d?|rerip\d?)\b",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static readonly Regex VersionRegex = new (@"\d[-._ ]?v(?<version>\d)[-._ ]|\[v(?<version>\d)\]",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex VersionRegex = new (@"\d[-._ ]?v(?<version>\d)[-._ ]|\[v(?<version>\d)\]|repack(?<version>\d)|rerip(?<version>\d)",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static readonly Regex RealRegex = new (@"\b(?<real>REAL)\b",
|
||||
RegexOptions.Compiled);
|
||||
|
|
@ -706,19 +706,6 @@ private static QualityModel ParseQualityModifiers(string name, string normalized
|
|||
{
|
||||
var result = new QualityModel { Quality = Quality.Unknown };
|
||||
|
||||
if (ProperRegex.IsMatch(normalizedName))
|
||||
{
|
||||
result.Revision.Version = 2;
|
||||
result.RevisionDetectionSource = QualityDetectionSource.Name;
|
||||
}
|
||||
|
||||
if (RepackRegex.IsMatch(normalizedName))
|
||||
{
|
||||
result.Revision.Version = 2;
|
||||
result.Revision.IsRepack = true;
|
||||
result.RevisionDetectionSource = QualityDetectionSource.Name;
|
||||
}
|
||||
|
||||
var versionRegexResult = VersionRegex.Match(normalizedName);
|
||||
|
||||
if (versionRegexResult.Success)
|
||||
|
|
@ -727,6 +714,19 @@ private static QualityModel ParseQualityModifiers(string name, string normalized
|
|||
result.RevisionDetectionSource = QualityDetectionSource.Name;
|
||||
}
|
||||
|
||||
if (ProperRegex.IsMatch(normalizedName))
|
||||
{
|
||||
result.Revision.Version = versionRegexResult.Success ? Convert.ToInt32(versionRegexResult.Groups["version"].Value) + 1 : 2;
|
||||
result.RevisionDetectionSource = QualityDetectionSource.Name;
|
||||
}
|
||||
|
||||
if (RepackRegex.IsMatch(normalizedName))
|
||||
{
|
||||
result.Revision.Version = versionRegexResult.Success ? Convert.ToInt32(versionRegexResult.Groups["version"].Value) + 1 : 2;
|
||||
result.Revision.IsRepack = true;
|
||||
result.RevisionDetectionSource = QualityDetectionSource.Name;
|
||||
}
|
||||
|
||||
// TODO: re-enable this when we have a reliable way to determine real
|
||||
// TODO: Only treat it as a real if it comes AFTER the season/episode number
|
||||
var realRegexResult = RealRegex.Matches(name);
|
||||
|
|
|
|||
Loading…
Reference in a new issue