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.
37 lines
1.4 KiB
37 lines
1.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
|
using NzbDrone.Core.Tv;
|
|
using NzbDrone.SignalR;
|
|
using Sonarr.Api.V3.Episodes;
|
|
using Sonarr.Http;
|
|
|
|
namespace Sonarr.Api.V3.Calendar
|
|
{
|
|
[V3ApiController]
|
|
public class CalendarController : EpisodeControllerWithSignalR
|
|
{
|
|
public CalendarController(IBroadcastSignalRMessage signalR,
|
|
IEpisodeService episodeService,
|
|
ISeriesService seriesService,
|
|
IUpgradableSpecification qualityUpgradableSpecification)
|
|
: base(episodeService, seriesService, qualityUpgradableSpecification, signalR)
|
|
{
|
|
}
|
|
|
|
[HttpGet]
|
|
[Produces("application/json")]
|
|
public List<EpisodeResource> GetCalendar(DateTime? start, DateTime? end, bool unmonitored = false, bool includeSeries = false, bool includeEpisodeFile = false, bool includeEpisodeImages = false)
|
|
{
|
|
var startUse = start ?? DateTime.Today;
|
|
var endUse = end ?? DateTime.Today.AddDays(2);
|
|
|
|
var resources = MapToResource(_episodeService.EpisodesBetweenDates(startUse, endUse, unmonitored), includeSeries, includeEpisodeFile, includeEpisodeImages);
|
|
|
|
return resources.OrderBy(e => e.AirDateUtc).ToList();
|
|
}
|
|
}
|
|
}
|