mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Option to convert ical feed items to all-day events
This commit is contained in:
parent
01e2f4e7e5
commit
da451cfe03
@ -37,6 +37,7 @@ private Response GetCalendarFeed()
|
||||
var end = DateTime.Today.AddDays(futureDays);
|
||||
var unmonitored = false;
|
||||
var premiersOnly = false;
|
||||
var asAllDay = false;
|
||||
var tags = new List<int>();
|
||||
|
||||
// TODO: Remove start/end parameters in v3, they don't work well for iCal
|
||||
@ -46,6 +47,7 @@ private Response GetCalendarFeed()
|
||||
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 @@ private Response GetCalendarFeed()
|
||||
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 @@ private Response GetCalendarFeed()
|
||||
var occurrence = calendar.Create<Event>();
|
||||
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<string>() { 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:
|
||||
|
@ -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() + '&';
|
||||
}
|
||||
|
@ -41,6 +41,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Show as All-Day Events</label>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<label class="checkbox toggle well">
|
||||
<input type="checkbox" name="asAllDay" class="form-control x-asAllDay"/>
|
||||
|
||||
<p>
|
||||
<span>Yes</span>
|
||||
<span>No</span>
|
||||
</p>
|
||||
|
||||
<div class="btn btn-primary slide-button"/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Tags</label>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user