Added Missing view to show which episodes are missing from disk for all series.

This commit is contained in:
Mark McDowall 2011-05-01 01:05:28 -07:00
parent 0e429f58a1
commit 86019a2597
4 changed files with 97 additions and 0 deletions

View File

@ -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));
}
}
}

View File

@ -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; }
}
}

View File

@ -215,6 +215,7 @@
<Compile Include="Controllers\HistoryController.cs" />
<Compile Include="Controllers\LogController.cs" />
<Compile Include="Controllers\AddSeriesController.cs" />
<Compile Include="Controllers\MissingController.cs" />
<Compile Include="Controllers\NotificationController.cs" />
<Compile Include="Controllers\SeriesController.cs" />
<Compile Include="Controllers\SettingsController.cs" />
@ -236,6 +237,7 @@
<Compile Include="Models\IndexerSettingsModel.cs" />
<Compile Include="Models\MappingModel.cs" />
<Compile Include="Models\EpisodeModel.cs" />
<Compile Include="Models\MissingEpisodeModel.cs" />
<Compile Include="Models\NotificationSettingsModel.cs" />
<Compile Include="Models\QualityModel.cs" />
<Compile Include="Models\SeriesSearchResultModel.cs" />
@ -830,6 +832,9 @@
<LastGenOutput>EditorLocalization.bg-BG.designer.cs</LastGenOutput>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Views\Missing\Index.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -0,0 +1,28 @@
@model List<MissingEpisodeModel>
@using NzbDrone.Web.Models;
@section MainContent{
@{Html.Telerik().Grid<MissingEpisodeModel>().Name("missing")
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(c => c.SeriesTitle).Title("Series Name");
columns.Bound(c => c.SeasonNumber).Title("Season").Width(1);
columns.Bound(c => c.EpisodeNumber).Title("Episode").Width(1);
columns.Bound(c => c.EpisodeTitle).Title("Episode Title");
columns.Bound(c => c.AirDate).Title("Air Date").Width(50);
})
.DetailView(detailView => detailView.ClientTemplate(
"<fieldset>" +
"<div><b>Overview: </b><#= Overview #></div>" +
"</fieldset>"
))
.DataBinding(data => data.Ajax().Select("_AjaxBinding", "Missing"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDate).Descending()).Enabled(true))
.Pageable(
c =>
c.PageSize(20).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious))
//.Filterable()
//.ClientEvents(c => c.OnRowDataBound("onRowDataBound"))
.Render();}
}