2011-05-01 10:05:28 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2012-12-06 02:54:09 +01:00
|
|
|
|
using System.Globalization;
|
2011-05-01 10:05:28 +02:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Mvc;
|
2012-02-09 02:05:16 +01:00
|
|
|
|
using System.Web.Script.Serialization;
|
2011-09-30 18:18:13 +02:00
|
|
|
|
using NzbDrone.Core;
|
2012-02-27 05:47:49 +01:00
|
|
|
|
using NzbDrone.Core.Helpers;
|
2011-05-01 10:05:28 +02:00
|
|
|
|
using NzbDrone.Core.Providers;
|
2012-12-21 06:36:48 +01:00
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
2011-05-01 10:05:28 +02:00
|
|
|
|
using NzbDrone.Web.Models;
|
2012-05-10 19:39:02 +02:00
|
|
|
|
using ServiceStack.Text;
|
2011-05-01 10:05:28 +02:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Web.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class MissingController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly EpisodeProvider _episodeProvider;
|
2012-12-21 06:36:48 +01:00
|
|
|
|
private readonly ConfigProvider _configProvider;
|
2011-05-01 10:05:28 +02:00
|
|
|
|
|
2012-12-21 06:36:48 +01:00
|
|
|
|
public MissingController(EpisodeProvider episodeProvider, ConfigProvider configProvider)
|
2011-05-01 10:05:28 +02:00
|
|
|
|
{
|
|
|
|
|
_episodeProvider = episodeProvider;
|
2012-12-21 06:36:48 +01:00
|
|
|
|
_configProvider = configProvider;
|
2011-05-01 10:05:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
2012-02-09 02:05:16 +01:00
|
|
|
|
var missingEpisodes = _episodeProvider.EpisodesWithoutFiles(false);
|
2012-12-21 06:36:48 +01:00
|
|
|
|
var ignoreArticles = _configProvider.IgnoreArticlesWhenSortingSeries;
|
2012-02-09 02:05:16 +01:00
|
|
|
|
|
|
|
|
|
var missing = missingEpisodes.Select(e => new MissingEpisodeModel
|
|
|
|
|
{
|
|
|
|
|
EpisodeId = e.EpisodeId,
|
|
|
|
|
SeriesId = e.SeriesId,
|
|
|
|
|
EpisodeNumbering = string.Format("{0}x{1:00}", e.SeasonNumber, e.EpisodeNumber),
|
|
|
|
|
EpisodeTitle = e.Title,
|
|
|
|
|
Overview = e.Overview,
|
|
|
|
|
SeriesTitle = e.Series.Title,
|
2012-12-21 06:36:48 +01:00
|
|
|
|
SeriesTitleSorter = ignoreArticles ? e.Series.Title.IgnoreArticles() : e.Series.Title,
|
2012-12-06 02:54:09 +01:00
|
|
|
|
AirDateSorter = e.AirDate.Value.ToString("o", CultureInfo.InvariantCulture),
|
|
|
|
|
AirDate = e.AirDate.Value.ToBestDateString()
|
2012-02-09 02:05:16 +01:00
|
|
|
|
});
|
|
|
|
|
|
2012-05-10 19:39:02 +02:00
|
|
|
|
JsConfig.IncludeNullValues = true;
|
2012-05-10 18:53:37 +02:00
|
|
|
|
return View(missing);
|
2011-05-01 10:05:28 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|