1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-24 00:42:38 +00:00

Updated parser to skip longer than expected numbers from being parsed.

This commit is contained in:
Mark McDowall 2012-01-02 18:18:36 -08:00
parent ffde7c0987
commit e958a019ed
2 changed files with 9 additions and 2 deletions

View file

@ -390,5 +390,12 @@ public void unparsable_should_log_error_but_not_throw(string title)
ExceptionVerification.IgnoreWarns();
ExceptionVerification.ExpectedErrors(1);
}
[TestCase(@"C:\BuildAgent\work\b5a20f8391187721\NzbDrone.Core.Test\bin\Release\WEEDS.avi")]
public void parseTitle_should_log_warning_when_unable_to_parse(string title)
{
Parser.ParseTitle(title);
ExceptionVerification.ExpectedWarns(1);
}
}
}

View file

@ -44,11 +44,11 @@ public static class Parser
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Supports 1103/1113 naming
new Regex(@"^(?<title>.+?)?(?:\W?(?<season>\d{2})(?<episode>\d{2}(?!p|i)))+\W?(?!\\)",
new Regex(@"^(?<title>.+?)?(?:\W?(?<season>(?<!\d+)\d{2})(?<episode>\d{2}(?!p|i|\d+)))+\W?(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Supports 103/113 naming
new Regex(@"^(?<title>.+?)?(?:\W?(?<season>\d{1})(?<episode>\d{2}(?!p|i|\d+)))+\W?(?!\\)",
new Regex(@"^(?<title>.+?)?(?:\W?(?<season>(?<!\d+)\d{1})(?<episode>\d{2}(?!p|i|\d+)))+\W?(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Supports Season only releases