diff --git a/src/NzbDrone.Api/Calendar/CalendarFeedModule.cs b/src/NzbDrone.Api/Calendar/CalendarFeedModule.cs index 0e62517f9..4845bc653 100644 --- a/src/NzbDrone.Api/Calendar/CalendarFeedModule.cs +++ b/src/NzbDrone.Api/Calendar/CalendarFeedModule.cs @@ -37,6 +37,7 @@ namespace NzbDrone.Api.Calendar var end = DateTime.Today.AddDays(futureDays); var unmonitored = false; var premiersOnly = false; + var asAllDay = false; var tags = new List(); // TODO: Remove start/end parameters in v3, they don't work well for iCal @@ -46,6 +47,7 @@ namespace NzbDrone.Api.Calendar var queryFutureDays = Request.Query.FutureDays; var queryUnmonitored = Request.Query.Unmonitored; var queryPremiersOnly = Request.Query.PremiersOnly; + var queryAsAllDay = Request.Query.AsAllDay; var queryTags = Request.Query.Tags; if (queryStart.HasValue) start = DateTime.Parse(queryStart.Value); @@ -73,6 +75,11 @@ namespace NzbDrone.Api.Calendar premiersOnly = bool.Parse(queryPremiersOnly.Value); } + if (queryAsAllDay.HasValue) + { + asAllDay = bool.Parse(queryAsAllDay.Value); + } + if (queryTags.HasValue) { var tagInput = (string)queryTags.Value.ToString(); @@ -102,11 +109,19 @@ namespace NzbDrone.Api.Calendar var occurrence = calendar.Create(); occurrence.Uid = "NzbDrone_episode_" + episode.Id; occurrence.Status = episode.HasFile ? EventStatus.Confirmed : EventStatus.Tentative; - occurrence.Start = new CalDateTime(episode.AirDateUtc.Value) { HasTime = true }; - occurrence.End = new CalDateTime(episode.AirDateUtc.Value.AddMinutes(episode.Series.Runtime)) { HasTime = true }; occurrence.Description = episode.Overview; occurrence.Categories = new List() { episode.Series.Network }; + if (asAllDay) + { + occurrence.Start = new CalDateTime(episode.AirDateUtc.Value) { HasTime = false }; + } + else + { + occurrence.Start = new CalDateTime(episode.AirDateUtc.Value) { HasTime = true }; + occurrence.End = new CalDateTime(episode.AirDateUtc.Value.AddMinutes(episode.Series.Runtime)) { HasTime = true }; + } + switch (episode.Series.SeriesType) { case SeriesTypes.Daily: diff --git a/src/UI/Calendar/CalendarFeedView.js b/src/UI/Calendar/CalendarFeedView.js index 2d1bae197..96bf3f518 100644 --- a/src/UI/Calendar/CalendarFeedView.js +++ b/src/UI/Calendar/CalendarFeedView.js @@ -9,6 +9,7 @@ module.exports = Marionette.Layout.extend({ ui : { includeUnmonitored : '.x-includeUnmonitored', premiersOnly : '.x-premiersOnly', + asAllDay : '.x-asAllDay', tags : '.x-tags', icalUrl : '.x-ical-url', icalCopy : '.x-ical-copy', @@ -18,6 +19,7 @@ module.exports = Marionette.Layout.extend({ events : { 'click .x-includeUnmonitored' : '_updateUrl', 'click .x-premiersOnly' : '_updateUrl', + 'click .x-asAllDay' : '_updateUrl', 'itemAdded .x-tags' : '_updateUrl', 'itemRemoved .x-tags' : '_updateUrl' }, @@ -29,7 +31,7 @@ module.exports = Marionette.Layout.extend({ }, _updateUrl : function() { - var icalUrl = window.location.host + StatusModel.get('urlBase') + '/feed/calendar/NzbDrone.ics?'; + var icalUrl = window.location.host + StatusModel.get('urlBase') + '/feed/calendar/Sonarr.ics?'; if (this.ui.includeUnmonitored.prop('checked')) { icalUrl += 'unmonitored=true&'; @@ -39,6 +41,10 @@ module.exports = Marionette.Layout.extend({ icalUrl += 'premiersOnly=true&'; } + if (this.ui.asAllDay.prop('checked')) { + icalUrl += 'asAllDay=true&'; + } + if (this.ui.tags.val()) { icalUrl += 'tags=' + this.ui.tags.val() + '&'; } diff --git a/src/UI/Calendar/CalendarFeedViewTemplate.hbs b/src/UI/Calendar/CalendarFeedViewTemplate.hbs index c192c740d..763ac5b10 100644 --- a/src/UI/Calendar/CalendarFeedViewTemplate.hbs +++ b/src/UI/Calendar/CalendarFeedViewTemplate.hbs @@ -41,6 +41,24 @@ +
+ + +
+
+
+