diff --git a/NzbDrone.Core.Test/ParserTest.cs b/NzbDrone.Core.Test/ParserTest.cs
index ff6afb8a7..76deb79bb 100644
--- a/NzbDrone.Core.Test/ParserTest.cs
+++ b/NzbDrone.Core.Test/ParserTest.cs
@@ -123,6 +123,19 @@ namespace NzbDrone.Core.Test
Assert.IsNull(result.Episodes);
}
+
+ [Test]
+ [Row("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)]
+ [Row("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)]
+ [Row("The.Office.US.S03.720p.x264-DIMENSION", "The.Office.US", 3)]
+ public void full_season_release_parse(string postTitle, string title, int season)
+ {
+ var result = Parser.ParseEpisodeInfo(postTitle);
+ Assert.AreEqual(season, result.SeasonNumber);
+ Assert.AreEqual(Parser.NormalizeTitle(title), result.CleanTitle);
+ Assert.AreEqual(0, result.Episodes.Count);
+ }
+
[Test]
[Row("Conan", "conan")]
[Row("The Tonight Show With Jay Leno", "tonightshowwithjayleno")]
diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs
index 73bf457ad..e67d7738e 100644
--- a/NzbDrone.Core/Parser.cs
+++ b/NzbDrone.Core/Parser.cs
@@ -19,10 +19,11 @@ namespace NzbDrone.Core
new Regex(@"^(?
.*?)?(?:\W?S?(?\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|\sto\s){1,2}(?\d{1,2}(?!\d+)))+)+\W?(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
new Regex(@"^(?.+?)?\W?(?:\W(?\d+)(?\d{2}))+\W?(?!\\)",
- RegexOptions.IgnoreCase | RegexOptions.Compiled),
- //Supports 103/113 naming
+ RegexOptions.IgnoreCase | RegexOptions.Compiled), //Supports 103/113 naming
new Regex(@"^(?.*?)?(?:\W?S?(?\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|to)+(?\d+))+)+\W?(?!\\)",
- RegexOptions.IgnoreCase | RegexOptions.Compiled)
+ RegexOptions.IgnoreCase | RegexOptions.Compiled),
+ new Regex(@"^(?.*?)\W(?:S|Season\W?)?(?\d{1,2}(?!\d+))+\W?(?!\\)",
+ RegexOptions.IgnoreCase | RegexOptions.Compiled) //Supports Season only releases
};
private static readonly Regex[] SeasonReportTitleRegex = new[]
@@ -75,13 +76,18 @@ namespace NzbDrone.Core
foreach (Match matchGroup in match)
{
- var count = matchGroup.Groups["episode"].Captures.Count;
- var first = Convert.ToInt32(matchGroup.Groups["episode"].Captures[0].Value);
- var last = Convert.ToInt32(matchGroup.Groups["episode"].Captures[count - 1].Value);
-
- for (int i = first; i <= last; i++)
- {
- parsedEpisode.Episodes.Add(i);
+ var count = matchGroup.Groups["episode"].Captures.Count;
+
+ //Allows use to return a list of 0 episodes (We can handle that as a full season release)
+ if (count > 0)
+ {
+ var first = Convert.ToInt32(matchGroup.Groups["episode"].Captures[0].Value);
+ var last = Convert.ToInt32(matchGroup.Groups["episode"].Captures[count - 1].Value);
+
+ for (int i = first; i <= last; i++)
+ {
+ parsedEpisode.Episodes.Add(i);
+ }
}
}
}