1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00
Radarr/NzbDrone.Api/Missing/MissingModule.cs
2013-03-31 23:22:16 -07:00

31 lines
917 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Missing
{
public class MissingModule : NzbDroneApiModule
{
private readonly IEpisodeService _episodeService;
public MissingModule(IEpisodeService episodeService)
: base("/missing")
{
_episodeService = episodeService;
Get["/"] = x => GetMissingEpisodes();
}
private Response GetMissingEpisodes()
{
bool includeSpecials;
Boolean.TryParse(PrimitiveExtensions.ToNullSafeString(Request.Query.IncludeSpecials), out includeSpecials);
var episodes = _episodeService.EpisodesWithoutFiles(includeSpecials);
return Mapper.Map<List<Episode>, List<MissingResource>>(episodes).AsResponse();
}
}
}