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.
Lidarr/NzbDrone.Api/Upcoming/UpcomingModule.cs

35 lines
982 B

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using AutoMapper;
using FluentValidation;
using Nancy;
12 years ago
using NzbDrone.Api.Extensions;
using NzbDrone.Api.Series;
using NzbDrone.Common;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Upcoming
{
public class UpcomingModule : NzbDroneApiModule
{
private readonly UpcomingEpisodesProvider _upcomingEpisodesProvider;
public UpcomingModule(UpcomingEpisodesProvider upcomingEpisodesProvider)
: base("/Upcoming")
{
_upcomingEpisodesProvider = upcomingEpisodesProvider;
Get["/"] = x => Upcoming();
}
private Response Upcoming()
{
var upcoming = _upcomingEpisodesProvider.UpcomingEpisodes();
return Mapper.Map<List<Episode>, List<UpcomingResource>>(upcoming).AsResponse();
}
}
}