|
|
|
@ -73,6 +73,10 @@ namespace NzbDrone.Core.Parser
|
|
|
|
|
new Regex(@"^\[(?<subgroup>.+?)\][-_. ]?(?<title>[^-]+?)(?:(?<![-_. ]|\b[0]\d+) - )[-_. ]?(?<absoluteepisode>\d{2,3}(\.\d{1,2})?(?!\d+))~(?<absoluteepisode>\d{2,3}(\.\d{1,2})?(?!\d+))(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>\[\w{8}\])?(?:$|\.mkv)",
|
|
|
|
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
|
|
|
|
|
|
|
|
|
//Anime - [SubGroup] Title with season number in brackets Absolute Episode Number
|
|
|
|
|
new Regex(@"^\[(?<subgroup>.+?)\][-_. ]?(?<title>[^-]+?)[_. ]+?\(Season[_. ](?<season>\d+)\)[-_. ]+?(?:[-_. ]?(?<absoluteepisode>\d{2,3}(\.\d{1,2})?(?!\d+)))+(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>\[\w{8}\])?(?:$|\.mkv)",
|
|
|
|
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
|
|
|
|
|
|
|
|
|
//Anime - [SubGroup] Title with trailing number Absolute Episode Number
|
|
|
|
|
new Regex(@"^\[(?<subgroup>.+?)\][-_. ]?(?<title>[^-]+?)(?:(?<![-_. ]|\b[0]\d+) - )(?:[-_. ]?(?<absoluteepisode>\d{2,3}(\.\d{1,2})?(?!\d+)))+(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>\[\w{8}\])?(?:$|\.mkv)",
|
|
|
|
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
|
|
|
@ -748,37 +752,13 @@ namespace NzbDrone.Core.Parser
|
|
|
|
|
|
|
|
|
|
if (airYear < 1900)
|
|
|
|
|
{
|
|
|
|
|
var seasons = new List<int>();
|
|
|
|
|
|
|
|
|
|
foreach (Capture seasonCapture in matchCollection[0].Groups["season"].Captures)
|
|
|
|
|
{
|
|
|
|
|
int parsedSeason;
|
|
|
|
|
if (int.TryParse(seasonCapture.Value, out parsedSeason))
|
|
|
|
|
{
|
|
|
|
|
seasons.Add(parsedSeason);
|
|
|
|
|
|
|
|
|
|
lastSeasonEpisodeStringIndex = Math.Max(lastSeasonEpisodeStringIndex, seasonCapture.EndIndex());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//If no season was found it should be treated as a mini series and season 1
|
|
|
|
|
if (seasons.Count == 0) seasons.Add(1);
|
|
|
|
|
|
|
|
|
|
result = new ParsedEpisodeInfo
|
|
|
|
|
{
|
|
|
|
|
ReleaseTitle = releaseTitle,
|
|
|
|
|
SeasonNumber = seasons.First(),
|
|
|
|
|
EpisodeNumbers = new int[0],
|
|
|
|
|
AbsoluteEpisodeNumbers = new int[0]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//If more than 1 season was parsed set IsMultiSeason to true so it can be rejected later
|
|
|
|
|
if (seasons.Distinct().Count() > 1)
|
|
|
|
|
{
|
|
|
|
|
result.IsMultiSeason = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (Match matchGroup in matchCollection)
|
|
|
|
|
{
|
|
|
|
|
var episodeCaptures = matchGroup.Groups["episode"].Captures.Cast<Capture>().ToList();
|
|
|
|
@ -860,9 +840,34 @@ namespace NzbDrone.Core.Parser
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result.AbsoluteEpisodeNumbers.Any() && !result.EpisodeNumbers.Any())
|
|
|
|
|
var seasons = new List<int>();
|
|
|
|
|
|
|
|
|
|
foreach (Capture seasonCapture in matchCollection[0].Groups["season"].Captures)
|
|
|
|
|
{
|
|
|
|
|
int parsedSeason;
|
|
|
|
|
if (int.TryParse(seasonCapture.Value, out parsedSeason))
|
|
|
|
|
{
|
|
|
|
|
seasons.Add(parsedSeason);
|
|
|
|
|
|
|
|
|
|
lastSeasonEpisodeStringIndex = Math.Max(lastSeasonEpisodeStringIndex, seasonCapture.EndIndex());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//If more than 1 season was parsed set IsMultiSeason to true so it can be rejected later
|
|
|
|
|
if (seasons.Distinct().Count() > 1)
|
|
|
|
|
{
|
|
|
|
|
result.IsMultiSeason = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (seasons.Any())
|
|
|
|
|
{
|
|
|
|
|
// If at least one season was parsed use the first season as the season
|
|
|
|
|
result.SeasonNumber = seasons.First();
|
|
|
|
|
}
|
|
|
|
|
else if (!result.AbsoluteEpisodeNumbers.Any() && result.EpisodeNumbers.Any())
|
|
|
|
|
{
|
|
|
|
|
result.SeasonNumber = 0;
|
|
|
|
|
// If no season was found and it's not an absolute only release it should be treated as a mini series and season 1
|
|
|
|
|
result.SeasonNumber = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|