mirror of
https://github.com/Radarr/Radarr
synced 2024-12-29 03:15:19 +00:00
Selectable range for iCal
New: Support for pastDays and fututeDays query parameters on iCal requests Closes #974
This commit is contained in:
parent
4e728c3a02
commit
800fa42982
1 changed files with 19 additions and 2 deletions
|
@ -22,15 +22,32 @@ public CalendarFeedModule(IEpisodeService episodeService)
|
|||
|
||||
private Response GetCalendarFeed()
|
||||
{
|
||||
var start = DateTime.Today.AddDays(-7);
|
||||
var end = DateTime.Today.AddDays(28);
|
||||
var pastDays = 7;
|
||||
var futureDays = 28;
|
||||
var start = DateTime.Today.AddDays(-pastDays);
|
||||
var end = DateTime.Today.AddDays(futureDays);
|
||||
|
||||
// TODO: Remove start/end parameters in v3, they don't work well for iCal
|
||||
var queryStart = Request.Query.Start;
|
||||
var queryEnd = Request.Query.End;
|
||||
var queryPastDays = Request.Query.PastDays;
|
||||
var queryFutureDays = Request.Query.FutureDays;
|
||||
|
||||
if (queryStart.HasValue) start = DateTime.Parse(queryStart.Value);
|
||||
if (queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value);
|
||||
|
||||
if (queryPastDays.HasValue)
|
||||
{
|
||||
pastDays = int.Parse(queryPastDays.Value);
|
||||
start = DateTime.Today.AddDays(-pastDays);
|
||||
}
|
||||
|
||||
if (queryFutureDays.HasValue)
|
||||
{
|
||||
futureDays = int.Parse(queryFutureDays.Value);
|
||||
end = DateTime.Today.AddDays(futureDays);
|
||||
}
|
||||
|
||||
var episodes = _episodeService.EpisodesBetweenDates(start, end, false);
|
||||
var icalCalendar = new iCalendar();
|
||||
|
||||
|
|
Loading…
Reference in a new issue