mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
Moved Missing and History to Fancy
This commit is contained in:
parent
2f4ccff0a2
commit
9d96df9c2e
10 changed files with 121 additions and 80 deletions
|
@ -1,59 +1,29 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Episodes;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Api.Missing
|
||||
{
|
||||
public class MissingModule : NzbDroneApiModule
|
||||
public class MissingModule : NzbDroneRestModule<MissingResource>
|
||||
{
|
||||
private readonly IEpisodeService _episodeService;
|
||||
|
||||
public MissingModule(IEpisodeService episodeService)
|
||||
: base("/missing")
|
||||
{
|
||||
_episodeService = episodeService;
|
||||
Get["/"] = x => GetMissingEpisodes();
|
||||
GetResourcePaged = GetMissingEpisodes;
|
||||
}
|
||||
|
||||
private Response GetMissingEpisodes()
|
||||
private PagingResource<MissingResource> GetMissingEpisodes(PagingResource<MissingResource> pagingResource)
|
||||
{
|
||||
bool includeSpecials;
|
||||
Boolean.TryParse(PrimitiveExtensions.ToNullSafeString(Request.Query.IncludeSpecials), out includeSpecials);
|
||||
|
||||
int pageSize;
|
||||
Int32.TryParse(PrimitiveExtensions.ToNullSafeString(Request.Query.PageSize), out pageSize);
|
||||
if (pageSize == 0) pageSize = 20;
|
||||
|
||||
int page;
|
||||
Int32.TryParse(PrimitiveExtensions.ToNullSafeString(Request.Query.Page), out page);
|
||||
if (page == 0) page = 1;
|
||||
|
||||
var sortKey = PrimitiveExtensions.ToNullSafeString(Request.Query.SortKey);
|
||||
if (String.IsNullOrEmpty(sortKey)) sortKey = "AirDate";
|
||||
|
||||
var sortDirection = PrimitiveExtensions.ToNullSafeString(Request.Query.SortDir)
|
||||
.Equals("Asc", StringComparison.InvariantCultureIgnoreCase)
|
||||
? SortDirection.Ascending
|
||||
: SortDirection.Descending;
|
||||
|
||||
var pagingSpec = new PagingSpec<Episode>
|
||||
{
|
||||
Page = page,
|
||||
PageSize = pageSize,
|
||||
SortKey = sortKey,
|
||||
SortDirection = sortDirection
|
||||
};
|
||||
{
|
||||
Page = pagingResource.Page,
|
||||
PageSize = pagingResource.PageSize,
|
||||
SortKey = pagingResource.SortKey,
|
||||
SortDirection = pagingResource.SortDirection
|
||||
};
|
||||
|
||||
var result = _episodeService.EpisodesWithoutFiles(pagingSpec, includeSpecials);
|
||||
|
||||
return Mapper.Map<PagingSpec<Episode>, PagingResource<EpisodeResource>>(result).AsResponse();
|
||||
return ApplyToPage(_episodeService.EpisodesWithoutFiles, pagingSpec);
|
||||
}
|
||||
}
|
||||
}
|
34
NzbDrone.Api/Missing/MissingResource.cs
Normal file
34
NzbDrone.Api/Missing/MissingResource.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using NzbDrone.Api.REST;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Api.Missing
|
||||
{
|
||||
public class MissingResource : RestResource
|
||||
{
|
||||
public Int32 Id { get; set; }
|
||||
public Int32 SeriesId { get; set; }
|
||||
public Int32 EpisodeFileId { get; set; }
|
||||
public Int32 SeasonNumber { get; set; }
|
||||
public Int32 EpisodeNumber { get; set; }
|
||||
public String Title { get; set; }
|
||||
public DateTime? AirDate { get; set; }
|
||||
public EpisodeStatuses Status { get; set; }
|
||||
public String Overview { get; set; }
|
||||
public EpisodeFile EpisodeFile { get; set; }
|
||||
|
||||
public Boolean HasFile { get; set; }
|
||||
public Boolean Ignored { get; set; }
|
||||
public Int32 SceneEpisodeNumber { get; set; }
|
||||
public Int32 SceneSeasonNumber { get; set; }
|
||||
public Int32 TvDbEpisodeId { get; set; }
|
||||
public Int32? AbsoluteEpisodeNumber { get; set; }
|
||||
public DateTime? EndTime { get; set; }
|
||||
public DateTime? GrabDate { get; set; }
|
||||
public PostDownloadStatusType PostDownloadStatus { get; set; }
|
||||
public Core.Tv.Series Series { get; set; }
|
||||
public String SeriesTitle { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue