Some additional release group parsing tests
This commit is contained in:
parent
0b3e4c48f7
commit
69567de9a2
|
@ -20,6 +20,10 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||||
[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")]
|
[TestCase("Arrow.S02E01.720p.WEB-DL.DD5.1.H.264.mkv", "DRONE")]
|
||||||
[TestCase("Series Title S01E01 Episode Title", "DRONE")]
|
[TestCase("Series Title S01E01 Episode Title", "DRONE")]
|
||||||
|
[TestCase("The Colbert Report - 2014-06-02 - Thomas Piketty.mkv", "DRONE")]
|
||||||
|
[TestCase("Real Time with Bill Maher S12E17 May 23, 2014.mp4", "DRONE")]
|
||||||
|
[TestCase("Reizen Waes - S01E08 - Transistrië, Zuid-Ossetië en Abchazië SDTV.avi", "DRONE")]
|
||||||
|
[TestCase("Simpsons 10x11 - Wild Barts Cant Be Broken [rl].avi", "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);
|
||||||
|
|
|
@ -284,13 +284,14 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
title = title.TrimEnd("-RP");
|
title = title.TrimEnd("-RP");
|
||||||
|
|
||||||
string group;
|
|
||||||
var matches = ReleaseGroupRegex.Matches(title);
|
var matches = ReleaseGroupRegex.Matches(title);
|
||||||
|
|
||||||
if (matches.Count != 0)
|
if (matches.Count != 0)
|
||||||
{
|
{
|
||||||
group = matches.OfType<Match>().Last().Groups["releasegroup"].Value;
|
var group = matches.OfType<Match>().Last().Groups["releasegroup"].Value;
|
||||||
}
|
int groupIsNumeric;
|
||||||
else
|
|
||||||
|
if (Int32.TryParse(group, out groupIsNumeric))
|
||||||
{
|
{
|
||||||
return defaultReleaseGroup;
|
return defaultReleaseGroup;
|
||||||
}
|
}
|
||||||
|
@ -298,6 +299,9 @@ namespace NzbDrone.Core.Parser
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return defaultReleaseGroup;
|
||||||
|
}
|
||||||
|
|
||||||
public static string RemoveFileExtension(string title)
|
public static string RemoveFileExtension(string title)
|
||||||
{
|
{
|
||||||
if (!title.ContainsInvalidPathChars())
|
if (!title.ContainsInvalidPathChars())
|
||||||
|
|
Loading…
Reference in New Issue