1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Web/Controllers/MissingController.cs
Mark McDowall 2439b9e087 Allow sorting with articles (option)
New: Option to sort with articles (a, the, an) included
2012-12-20 21:36:48 -08:00

51 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;
using NzbDrone.Core;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Web.Models;
using ServiceStack.Text;
namespace NzbDrone.Web.Controllers
{
public class MissingController : Controller
{
private readonly EpisodeProvider _episodeProvider;
private readonly ConfigProvider _configProvider;
public MissingController(EpisodeProvider episodeProvider, ConfigProvider configProvider)
{
_episodeProvider = episodeProvider;
_configProvider = configProvider;
}
public ActionResult Index()
{
var missingEpisodes = _episodeProvider.EpisodesWithoutFiles(false);
var ignoreArticles = _configProvider.IgnoreArticlesWhenSortingSeries;
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,
SeriesTitleSorter = ignoreArticles ? e.Series.Title.IgnoreArticles() : e.Series.Title,
AirDateSorter = e.AirDate.Value.ToString("o", CultureInfo.InvariantCulture),
AirDate = e.AirDate.Value.ToBestDateString()
});
JsConfig.IncludeNullValues = true;
return View(missing);
}
}
}