1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

Small tweaks based on feedback from @markus101

This commit is contained in:
Cyberlane 2013-11-08 19:03:01 +00:00 committed by Mark McDowall
parent 44c1bc632e
commit 26d3d9dcd6
3 changed files with 23 additions and 30 deletions

View File

@ -44,7 +44,7 @@ public bool IsDaily()
public bool IsAbsoluteNumbering()
{
return AbsoluteEpisodeNumbers.Length > 0;
return AbsoluteEpisodeNumbers.Any();
}
}
}

View File

@ -246,7 +246,7 @@ private static ParsedEpisodeInfo ParseMatchCollection(MatchCollection matchColle
{
SeasonNumber = seasons.First(),
EpisodeNumbers = new int[0],
AbsoluteEpisodeNumbers = new int[0]
AbsoluteEpisodeNumbers = new int[0]
};
foreach (Match matchGroup in matchCollection)
@ -255,36 +255,31 @@ private static ParsedEpisodeInfo ParseMatchCollection(MatchCollection matchColle
var absoluteEpisodeCaptures = matchGroup.Groups["absoluteepisode"].Captures.Cast<Capture>().ToList();
//Allows use to return a list of 0 episodes (We can handle that as a full season release)
var eps = episodeCaptures.Any();
var epsAbs = absoluteEpisodeCaptures.Any();
if (eps || epsAbs)
if (episodeCaptures.Any())
{
if (eps)
var first = Convert.ToInt32(episodeCaptures.First().Value);
var last = Convert.ToInt32(episodeCaptures.Last().Value);
if (first > last)
{
var first = Convert.ToInt32(episodeCaptures.First().Value);
var last = Convert.ToInt32(episodeCaptures.Last().Value);
if (first > last)
{
return null;
}
var count = last - first + 1;
result.EpisodeNumbers = Enumerable.Range(first, count).ToArray();
return null;
}
if (epsAbs)
var count = last - first + 1;
result.EpisodeNumbers = Enumerable.Range(first, count).ToArray();
}
else if (absoluteEpisodeCaptures.Any())
{
var first = Convert.ToInt32(absoluteEpisodeCaptures.First().Value);
var last = Convert.ToInt32(absoluteEpisodeCaptures.Last().Value);
if (first > last)
{
var first = Convert.ToInt32(absoluteEpisodeCaptures.First().Value);
var last = Convert.ToInt32(absoluteEpisodeCaptures.Last().Value);
if (first > last)
{
return null;
}
var count = last - first + 1;
result.AbsoluteEpisodeNumbers = Enumerable.Range(first, count).ToArray();
return null;
}
var count = last - first + 1;
result.AbsoluteEpisodeNumbers = Enumerable.Range(first, count).ToArray();
}
else
{

View File

@ -137,11 +137,9 @@ public List<Episode> GetEpisodes(ParsedEpisodeInfo parsedEpisodeInfo, Series ser
if (episodeInfo != null)
{
_logger.Info("Using absolute episode number {0} for: {1} - Scene: {2}x{3:00} - TVDB: {4}x{5:00}",
_logger.Info("Using absolute episode number {0} for: {1} - TVDB: {2}x{3:00}",
absoluteEpisodeNumber,
series.Title,
episodeInfo.SceneSeasonNumber,
episodeInfo.SceneEpisodeNumber,
episodeInfo.SeasonNumber,
episodeInfo.EpisodeNumber);
result.Add(episodeInfo);