From 86019a2597860436dfaefe7731103a4666cc7701 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 1 May 2011 01:05:28 -0700 Subject: [PATCH] Added Missing view to show which episodes are missing from disk for all series. --- NzbDrone.Web/Controllers/MissingController.cs | 46 +++++++++++++++++++ NzbDrone.Web/Models/MissingEpisodeModel.cs | 18 ++++++++ NzbDrone.Web/NzbDrone.Web.csproj | 5 ++ NzbDrone.Web/Views/Missing/Index.cshtml | 28 +++++++++++ 4 files changed, 97 insertions(+) create mode 100644 NzbDrone.Web/Controllers/MissingController.cs create mode 100644 NzbDrone.Web/Models/MissingEpisodeModel.cs create mode 100644 NzbDrone.Web/Views/Missing/Index.cshtml diff --git a/NzbDrone.Web/Controllers/MissingController.cs b/NzbDrone.Web/Controllers/MissingController.cs new file mode 100644 index 000000000..e56787847 --- /dev/null +++ b/NzbDrone.Web/Controllers/MissingController.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using NzbDrone.Core.Providers; +using NzbDrone.Web.Models; +using Telerik.Web.Mvc; + +namespace NzbDrone.Web.Controllers +{ + public class MissingController : Controller + { + private readonly EpisodeProvider _episodeProvider; + + public MissingController(EpisodeProvider episodeProvider) + { + _episodeProvider = episodeProvider; + } + + public ActionResult Index() + { + return View(); + } + + [GridAction] + public ActionResult _AjaxBinding() + { + //TODO: possible subsonic bug, IQuarible causes some issues so ToList() is called + //https://github.com/subsonic/SubSonic-3.0/issues/263 + + var missing = _episodeProvider.EpisodesWithoutFiles(false).Select(e => new MissingEpisodeModel + { + EpisodeId = e.EpisodeId, + SeasonNumber = e.SeasonNumber, + EpisodeNumber = e.EpisodeNumber, + EpisodeTitle = e.Title, + Overview = e.Overview, + SeriesTitle = e.Series.Title, + AirDate = e.AirDate, + }); + + return View(new GridModel(missing)); + } + } +} diff --git a/NzbDrone.Web/Models/MissingEpisodeModel.cs b/NzbDrone.Web/Models/MissingEpisodeModel.cs new file mode 100644 index 000000000..468109456 --- /dev/null +++ b/NzbDrone.Web/Models/MissingEpisodeModel.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace NzbDrone.Web.Models +{ + public class MissingEpisodeModel + { + public int EpisodeId { get; set; } + public string SeriesTitle { get; set; } + public int SeasonNumber { get; set; } + public int EpisodeNumber { get; set; } + public string EpisodeTitle { get; set; } + public DateTime AirDate { get; set; } + public string Overview { get; set; } + } +} \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 18e901683..426016b90 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -215,6 +215,7 @@ + @@ -236,6 +237,7 @@ + @@ -830,6 +832,9 @@ EditorLocalization.bg-BG.designer.cs + + +