mirror of https://github.com/Radarr/Radarr
Fixed: Restricted allowed Release Groups to reduce erroneous matches.
This commit is contained in:
parent
79b2b14668
commit
afff79feae
|
@ -9,8 +9,8 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||||
public class ReleaseGroupParserFixture : CoreTest
|
public class ReleaseGroupParserFixture : CoreTest
|
||||||
{
|
{
|
||||||
[TestCase("Castle.2009.S01E14.English.HDTV.XviD-LOL", "LOL")]
|
[TestCase("Castle.2009.S01E14.English.HDTV.XviD-LOL", "LOL")]
|
||||||
[TestCase("Castle 2009 S01E14 English HDTV XviD LOL", "LOL")]
|
[TestCase("Castle 2009 S01E14 English HDTV XviD LOL", "DRONE")]
|
||||||
[TestCase("Acropolis Now S05 EXTRAS DVDRip XviD RUNNER", "RUNNER")]
|
[TestCase("Acropolis Now S05 EXTRAS DVDRip XviD RUNNER", "DRONE")]
|
||||||
[TestCase("Punky.Brewster.S01.EXTRAS.DVDRip.XviD-RUNNER", "RUNNER")]
|
[TestCase("Punky.Brewster.S01.EXTRAS.DVDRip.XviD-RUNNER", "RUNNER")]
|
||||||
[TestCase("2020.NZ.2011.12.02.PDTV.XviD-C4TV", "C4TV")]
|
[TestCase("2020.NZ.2011.12.02.PDTV.XviD-C4TV", "C4TV")]
|
||||||
[TestCase("The.Office.S03E115.DVDRip.XviD-OSiTV", "OSiTV")]
|
[TestCase("The.Office.S03E115.DVDRip.XviD-OSiTV", "OSiTV")]
|
||||||
|
@ -18,6 +18,7 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||||
[TestCase("The Office - S01E01 - Pilot [HTDV-720p]", "DRONE")]
|
[TestCase("The Office - S01E01 - Pilot [HTDV-720p]", "DRONE")]
|
||||||
[TestCase("The Office - S01E01 - Pilot [HTDV-1080p]", "DRONE")]
|
[TestCase("The Office - S01E01 - Pilot [HTDV-1080p]", "DRONE")]
|
||||||
[TestCase("The.Walking.Dead.S04E13.720p.WEB-DL.AAC2.0.H.264-Cyphanix", "Cyphanix")]
|
[TestCase("The.Walking.Dead.S04E13.720p.WEB-DL.AAC2.0.H.264-Cyphanix", "Cyphanix")]
|
||||||
|
[TestCase("Arrow.S02E01.720p.WEB-DL.DD5.1.H.264.mkv", "DRONE")]
|
||||||
public void should_parse_release_group(string title, string expected)
|
public void should_parse_release_group(string title, string expected)
|
||||||
{
|
{
|
||||||
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
|
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
|
||||||
|
|
|
@ -121,6 +121,9 @@ namespace NzbDrone.Core.Parser
|
||||||
private static readonly Regex AirDateRegex = new Regex(@"^(.*?)(?<!\d)((?<airyear>\d{4})[_.-](?<airmonth>[0-1][0-9])[_.-](?<airday>[0-3][0-9])|(?<airmonth>[0-1][0-9])[_.-](?<airday>[0-3][0-9])[_.-](?<airyear>\d{4}))(?!\d)",
|
private static readonly Regex AirDateRegex = new Regex(@"^(.*?)(?<!\d)((?<airyear>\d{4})[_.-](?<airmonth>[0-1][0-9])[_.-](?<airday>[0-3][0-9])|(?<airmonth>[0-1][0-9])[_.-](?<airday>[0-3][0-9])[_.-](?<airyear>\d{4}))(?!\d)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
|
private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?<releasegroup>[a-z0-9]+)\b(?<!WEB-DL|480p|720p|1080p)",
|
||||||
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
private static readonly Regex MultiPartCleanupRegex = new Regex(@"\(\d+\)$", RegexOptions.Compiled);
|
private static readonly Regex MultiPartCleanupRegex = new Regex(@"\(\d+\)$", RegexOptions.Compiled);
|
||||||
|
|
||||||
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>\bita\b|italian)|(?<german>german\b)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)FR)(?:\W|_)|(?<russian>\brus\b)",
|
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>\bita\b|italian)|(?<german>german\b)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)FR)(?:\W|_)|(?<russian>\brus\b)",
|
||||||
|
@ -281,24 +284,13 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
title = title.TrimEnd("-RP");
|
title = title.TrimEnd("-RP");
|
||||||
|
|
||||||
var index = title.LastIndexOf('-');
|
string group;
|
||||||
|
var matches = ReleaseGroupRegex.Matches(title);
|
||||||
if (index < 0)
|
if (matches.Count != 0)
|
||||||
index = title.LastIndexOf(' ');
|
{
|
||||||
|
group = matches.OfType<Match>().Last().Groups["releasegroup"].Value;
|
||||||
if (index < 0)
|
}
|
||||||
return defaultReleaseGroup;
|
else
|
||||||
|
|
||||||
var group = title.Substring(index + 1);
|
|
||||||
|
|
||||||
if (group.Length == title.Length)
|
|
||||||
return String.Empty;
|
|
||||||
|
|
||||||
group = group.Trim('-', ' ', '[', ']');
|
|
||||||
|
|
||||||
if (group.ToLower() == "480p" ||
|
|
||||||
group.ToLower() == "720p" ||
|
|
||||||
group.ToLower() == "1080p")
|
|
||||||
{
|
{
|
||||||
return defaultReleaseGroup;
|
return defaultReleaseGroup;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue