|
|
@ -14,6 +14,9 @@ namespace NzbDrone.Core
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Regex[] ReportTitleRegex = new[]
|
|
|
|
private static readonly Regex[] ReportTitleRegex = new[]
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
new Regex(
|
|
|
|
|
|
|
|
@"(?<title>.+?)?\W?(?<year>\d{4}?)?\W+(?<airyear>\d{4})\W+(?<airmonth>\d{2})\W+(?<airday>\d{2})\W?(?!\\)",
|
|
|
|
|
|
|
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
|
|
|
new Regex(
|
|
|
|
new Regex(
|
|
|
|
@"(?<title>.+?)?\W?(?<year>\d{4}?)?(?:\WS?(?<season>\d{1,2})(?:(?:\-|\.|[ex]|\s|to)+(?<episode>\d+))+)+\W?(?!\\)",
|
|
|
|
@"(?<title>.+?)?\W?(?<year>\d{4}?)?(?:\WS?(?<season>\d{1,2})(?:(?:\-|\.|[ex]|\s|to)+(?<episode>\d+))+)+\W?(?!\\)",
|
|
|
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
|
|
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
|
|
@ -60,11 +63,21 @@ namespace NzbDrone.Core
|
|
|
|
year = 0;
|
|
|
|
year = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var parsedEpisode = new EpisodeParseResult
|
|
|
|
var airyear = 0;
|
|
|
|
|
|
|
|
Int32.TryParse(match[0].Groups["airyear"].Value, out airyear);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EpisodeParseResult parsedEpisode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (airyear < 1 )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var season = 0;
|
|
|
|
|
|
|
|
Int32.TryParse(match[0].Groups["season"].Value, out season);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parsedEpisode = new EpisodeParseResult
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Proper = title.ToLower().Contains("proper"),
|
|
|
|
Proper = title.ToLower().Contains("proper"),
|
|
|
|
SeriesTitle = seriesName,
|
|
|
|
SeriesTitle = seriesName,
|
|
|
|
SeasonNumber = Convert.ToInt32(match[0].Groups["season"].Value),
|
|
|
|
SeasonNumber = season,
|
|
|
|
Year = year,
|
|
|
|
Year = year,
|
|
|
|
Episodes = new List<int>()
|
|
|
|
Episodes = new List<int>()
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -79,14 +92,29 @@ namespace NzbDrone.Core
|
|
|
|
{
|
|
|
|
{
|
|
|
|
parsedEpisode.Episodes.Add(i);
|
|
|
|
parsedEpisode.Episodes.Add(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//else
|
|
|
|
else
|
|
|
|
//{
|
|
|
|
{
|
|
|
|
// foreach (Capture ep in matchGroup.Groups["episode"].Captures)
|
|
|
|
//Try to Parse as a daily show
|
|
|
|
// {
|
|
|
|
if (airyear > 0)
|
|
|
|
// parsedEpisode.Episodes.Add(Convert.ToInt32(ep.Value));
|
|
|
|
{
|
|
|
|
// }
|
|
|
|
var airmonth = Convert.ToInt32(match[0].Groups["airmonth"].Value);
|
|
|
|
//}
|
|
|
|
var airday = Convert.ToInt32(match[0].Groups["airday"].Value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parsedEpisode = new EpisodeParseResult
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Proper = title.ToLower().Contains("proper"),
|
|
|
|
|
|
|
|
SeriesTitle = seriesName,
|
|
|
|
|
|
|
|
Year = year,
|
|
|
|
|
|
|
|
AirDate = new DateTime(airyear, airmonth, airday)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Something went wrong with this one... return null
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
parsedEpisode.Quality = ParseQuality(title);
|
|
|
|
parsedEpisode.Quality = ParseQuality(title);
|
|
|
|