1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-28 10:51:48 +00:00
Radarr/NzbDrone.Api/Missing/MissingModule.cs

39 lines
1.3 KiB
C#
Raw Normal View History

using System.Linq;
using NzbDrone.Api.Episodes;
using NzbDrone.Api.Extensions;
using NzbDrone.Common;
using NzbDrone.Core.Datastore;
2013-03-21 03:02:57 +00:00
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Missing
{
public class MissingModule : NzbDroneRestModule<EpisodeResource>
2013-03-21 03:02:57 +00:00
{
2013-04-01 06:22:16 +00:00
private readonly IEpisodeService _episodeService;
private readonly SeriesRepository _seriesRepository;
2013-03-21 03:02:57 +00:00
public MissingModule(IEpisodeService episodeService, SeriesRepository seriesRepository)
:base("missing")
2013-03-21 03:02:57 +00:00
{
_episodeService = episodeService;
_seriesRepository = seriesRepository;
2013-05-13 06:12:19 +00:00
GetResourcePaged = GetMissingEpisodes;
2013-03-21 03:02:57 +00:00
}
private PagingResource<EpisodeResource> GetMissingEpisodes(PagingResource<EpisodeResource> pagingResource)
2013-03-21 03:02:57 +00:00
{
2013-05-02 05:50:34 +00:00
var pagingSpec = new PagingSpec<Episode>
2013-05-13 06:12:19 +00:00
{
Page = pagingResource.Page,
PageSize = pagingResource.PageSize,
SortKey = pagingResource.SortKey,
SortDirection = pagingResource.SortDirection
};
var resource = ApplyToPage(_episodeService.EpisodesWithoutFiles, pagingSpec);
resource.Records = resource.Records.LoadSubtype(e => e.SeriesId, _seriesRepository).ToList();
return resource;
2013-03-21 03:02:57 +00:00
}
}
}