You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readarr/NzbDrone.Api/Episodes/EpisodeModule.cs

30 lines
881 B

using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Episodes
{
public class EpisodeModule : NzbDroneApiModule
{
12 years ago
private readonly IEpisodeService _episodeService;
12 years ago
public EpisodeModule(IEpisodeService episodeService)
: base("/episodes")
{
_episodeService = episodeService;
Get["/"] = x => GetEpisodesForSeries();
}
private Response GetEpisodesForSeries()
{
var seriesId = (int)Request.Query.SeriesId;
var seasonNumber = (int)Request.Query.SeasonNumber;
var episodes = _episodeService.GetEpisodesBySeason(seriesId, seasonNumber);
return Mapper.Map<List<Episode>, List<EpisodeResource>>(episodes).AsResponse();
}
}
}