Fixed: Parsing of season and episode inside square brackets

Closes: #501
pull/6/head
Mark McDowall 10 years ago
parent f4b9d0336d
commit fb02499823

@ -107,6 +107,8 @@ namespace NzbDrone.Core.Test.ParserTests
//[TestCase("The 100 S02E01 HDTV x264-KILLERS [eztv]", "The 100", 2, 1)]
[TestCase("The Young And The Restless - S41 E10478 - 2014-08-15", "The Young and The Restless", 41, 10478)]
[TestCase("The Young And The Restless - S42 E10591 - 2015-01-27", "The Young and The Restless", 42, 10591)]
[TestCase("Series Title [1x05] Episode Title", "Series Title", 1, 5)]
[TestCase("Series Title [S01E05] Episode Title", "Series Title", 1, 5)]
//[TestCase("", "", 0, 0)]
public void should_parse_single_episode(string postTitle, string title, int seasonNumber, int episodeNumber)
{

@ -111,6 +111,10 @@ namespace NzbDrone.Core.Parser
new Regex(@"^(?<title>.+?)(?:(\W|_)+S?(?<season>(?<!\d+)\d{1,2}(?!\d+))(?:(?:\-|[ex]|\W[ex]|_){1,2}(?<episode>\d{4}(?!\d+|i|p)))+)\W?(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Episodes with a title and season/episode in square brackets
new Regex(@"^(?<title>.+?)(?:(\W|_)+\[S?(?<season>(?<!\d+)\d{1,2}(?!\d+))(?:(?:\-|[ex]|\W[ex]|_){1,2}(?<episode>(?<!\d+)\d{2}(?!\d+|i|p)))+\])\W?(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Episodes with single digit episode number (S01E1, S01E5E6, etc)
new Regex(@"^(?<title>.*?)(?:(?:_|-|\s|\.)S?(?<season>(?<!\d+)\d{1,2}(?!\d+))(?:(?:\-|[ex]){1,2}(?<episode>\d{1}))+)+(\W+|_|$)(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),

Loading…
Cancel
Save