Fixed: Parsing of poorly named double episode releases

Fixes #3439
This commit is contained in:
Mark McDowall 2019-12-29 01:48:56 -08:00
parent ec0c96bde4
commit 9189d8bf4d
2 changed files with 7 additions and 0 deletions

View File

@ -62,6 +62,9 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Are.You.Human.Too.E07-E08.180612.1080p-NEXT", "Are You Human Too", 1, new[] { 7, 8 })]
[TestCase("Are You Human Too? E11-E12 1080p HDTV AAC H.264-NEXT", "Are You Human Too", 1, new[] { 11, 12 })]
[TestCase("The Series Title (2010) - [S01E01-02-03] - Episode Title", "The Series Title (2010)", 1, new [] { 1, 2, 3 })]
[TestCase("[AqusiQ-TorrentS.pl]The.Name.of.the.Rose.S01E05-06.PL.2160p-Ralf[shogho]", "The Name of the Rose", 1, new[] { 5, 6 })]
[TestCase("[AgusiQ-TorrentS.pl] The.Name.of.the.Rose.S01E05-E06.PL.1080i.Ralf [jans12]", "The Name of the Rose", 1, new[] { 5, 6 })]
[TestCase("The.Name.of.the.Rose.S01E05-6.PL.1080p.WEBRip.x264-666", "The Name of the Rose", 1, new[] { 5, 6 })]
//[TestCase("", "", , new [] { })]
public void should_parse_multiple_episodes(string postTitle, string title, int season, int[] episodes)
{

View File

@ -116,6 +116,10 @@ namespace NzbDrone.Core.Parser
new Regex(@"^(?<title>.+?)?\W*(?<airyear>\d{4})\W+(?<airmonth>[0-1][0-9])\W+(?<airday>[0-3][0-9])(?!\W+[0-3][0-9]).+?(?:s?(?<season>(?<!\d+)(?:\d{1,2})(?!\d+)))(?:[ex](?<episode>(?<!\d+)(?:\d{1,3})(?!\d+)))",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
// Multi-episode with title (S01E05-06, S01E05-6)
new Regex(@"^(?<title>.+?)[-_. ]S(?<season>(?<!\d+)(?:\d{1,2})(?!\d+))E(?<episode>\d{1,2}(?!\d+))-(?<episode>\d{1,2}(?!\d+))[-_. ]",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Episodes with a title, Single episodes (S01E05, 1x05, etc) & Multi-episode (S01E05E06, S01E05-06, S01E05 E06, etc)
new Regex(@"^(?<title>.+?)(?:(?:[-_\W](?<![()\[!]))+S?(?<season>(?<!\d+)(?:\d{1,2})(?!\d+))(?:[ex]|\W[ex]){1,2}(?<episode>\d{2,3}(?!\d+))(?:(?:\-|[ex]|\W[ex]|_){1,2}(?<episode>\d{2,3}(?!\d+)))*)\W?(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),