|
|
@ -133,6 +133,21 @@ namespace NzbDrone.Web.Controllers
|
|
|
|
return View(new GridModel(episodes));
|
|
|
|
return View(new GridModel(episodes));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JsonResult GetEpisodeCount(int seriesId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var series = _seriesProvider.GetSeries(seriesId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var monitoredSeasons = series.Seasons.Where(e => e.Monitored).Select(e => e.SeasonId);
|
|
|
|
|
|
|
|
var episodeTotal = series.Episodes.Where(e => monitoredSeasons.Contains(e.SeasonId) && e.AirDate <= DateTime.Today && e.AirDate > new DateTime(1899, 12, 31));
|
|
|
|
|
|
|
|
var episodes = episodeTotal.Where(e => e.EpisodeFileId > 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Json(new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Episodes = episodes.Count(),
|
|
|
|
|
|
|
|
EpisodeTotal = episodeTotal.Count()
|
|
|
|
|
|
|
|
}, JsonRequestBehavior.AllowGet);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Local Helpers
|
|
|
|
//Local Helpers
|
|
|
|
private string GetEpisodePath(EpisodeFile file)
|
|
|
|
private string GetEpisodePath(EpisodeFile file)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -237,8 +252,6 @@ namespace NzbDrone.Web.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var s in seriesInDb)
|
|
|
|
foreach (var s in seriesInDb)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var episodesTotal = s.Episodes.Where(e => e.AirDate <= DateTime.Today && e.AirDate > new DateTime(1899, 12, 31));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
series.Add(new SeriesModel
|
|
|
|
series.Add(new SeriesModel
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SeriesId = s.SeriesId,
|
|
|
|
SeriesId = s.SeriesId,
|
|
|
@ -252,8 +265,8 @@ namespace NzbDrone.Web.Controllers
|
|
|
|
SeasonsCount = s.Seasons.Where(x => x.SeasonNumber > 0).Count(),
|
|
|
|
SeasonsCount = s.Seasons.Where(x => x.SeasonNumber > 0).Count(),
|
|
|
|
SeasonFolder = s.SeasonFolder,
|
|
|
|
SeasonFolder = s.SeasonFolder,
|
|
|
|
Status = s.Status,
|
|
|
|
Status = s.Status,
|
|
|
|
Episodes = episodesTotal.Where(e => e.EpisodeFileId != 0).Count(),
|
|
|
|
Episodes = 0,
|
|
|
|
EpisodeTotal = episodesTotal.Count()
|
|
|
|
EpisodeTotal = 0
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -265,7 +278,7 @@ namespace NzbDrone.Web.Controllers
|
|
|
|
if (seasonNumber == 0)
|
|
|
|
if (seasonNumber == 0)
|
|
|
|
return "Specials";
|
|
|
|
return "Specials";
|
|
|
|
|
|
|
|
|
|
|
|
return String.Format("Season# {0}", seasonNumber);
|
|
|
|
return String.Format("Season #{0}", seasonNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|