mirror of
https://github.com/Sonarr/Sonarr
synced 2026-05-07 04:20:50 +02:00
Bump Ical.Net to 5.2.1
This commit is contained in:
parent
bf5d48c76a
commit
b02e9945d1
4 changed files with 15 additions and 15 deletions
|
|
@ -77,12 +77,12 @@ public IActionResult GetCalendarFeed(int pastDays = 7, int futureDays = 28, stri
|
|||
|
||||
if (asAllDay)
|
||||
{
|
||||
occurrence.Start = new CalDateTime(episode.AirDateUtc.Value.ToLocalTime()) { HasTime = false };
|
||||
occurrence.Start = new CalDateTime(episode.AirDateUtc.Value.ToLocalTime(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
occurrence.Start = new CalDateTime(episode.AirDateUtc.Value) { HasTime = true };
|
||||
occurrence.End = new CalDateTime(episode.AirDateUtc.Value.AddMinutes(series.Runtime)) { HasTime = true };
|
||||
occurrence.Start = new CalDateTime(episode.AirDateUtc.Value, true);
|
||||
occurrence.End = new CalDateTime(episode.AirDateUtc.Value.AddMinutes(series.Runtime), true);
|
||||
}
|
||||
|
||||
switch (series.SeriesType)
|
||||
|
|
@ -96,10 +96,10 @@ public IActionResult GetCalendarFeed(int pastDays = 7, int futureDays = 28, stri
|
|||
}
|
||||
}
|
||||
|
||||
var serializer = (IStringSerializer)new SerializerFactory().Build(calendar.GetType(), new SerializationContext());
|
||||
var icalendar = serializer.SerializeToString(calendar);
|
||||
var serializer = new SerializerFactory().Build(calendar.GetType(), new SerializationContext()) as IStringSerializer;
|
||||
var icalendar = serializer?.SerializeToString(calendar);
|
||||
|
||||
return Content(icalendar, "text/calendar");
|
||||
return icalendar is null ? NoContent() : Content(icalendar, "text/calendar");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentValidation" Version="9.5.4" />
|
||||
<PackageReference Include="Ical.Net" Version="4.3.1" />
|
||||
<PackageReference Include="Ical.Net" Version="5.2.1" />
|
||||
<PackageReference Include="NLog" Version="5.5.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="10.1.7" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public CalendarFeedController(IEpisodeService episodeService, ISeriesService ser
|
|||
}
|
||||
|
||||
[HttpGet("Sonarr.ics")]
|
||||
public ContentHttpResult GetCalendarFeed(int pastDays = 7, int futureDays = 28, string tags = "", bool unmonitored = false, bool premieresOnly = false, bool asAllDay = false, bool includeSpecials = true)
|
||||
public Results<ContentHttpResult, NoContent> GetCalendarFeed(int pastDays = 7, int futureDays = 28, string tags = "", bool unmonitored = false, bool premieresOnly = false, bool asAllDay = false, bool includeSpecials = true)
|
||||
{
|
||||
var start = DateTime.Today.AddDays(-pastDays);
|
||||
var end = DateTime.Today.AddDays(futureDays);
|
||||
|
|
@ -76,12 +76,12 @@ public ContentHttpResult GetCalendarFeed(int pastDays = 7, int futureDays = 28,
|
|||
|
||||
if (asAllDay)
|
||||
{
|
||||
occurrence.Start = new CalDateTime(episode.AirDateUtc!.Value.ToLocalTime()) { HasTime = false };
|
||||
occurrence.Start = new CalDateTime(episode.AirDateUtc!.Value.ToLocalTime(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
occurrence.Start = new CalDateTime(episode.AirDateUtc!.Value) { HasTime = true };
|
||||
occurrence.End = new CalDateTime(episode.AirDateUtc.Value.AddMinutes(series.Runtime)) { HasTime = true };
|
||||
occurrence.Start = new CalDateTime(episode.AirDateUtc!.Value, true);
|
||||
occurrence.End = new CalDateTime(episode.AirDateUtc.Value.AddMinutes(series.Runtime), true);
|
||||
}
|
||||
|
||||
switch (series.SeriesType)
|
||||
|
|
@ -95,9 +95,9 @@ public ContentHttpResult GetCalendarFeed(int pastDays = 7, int futureDays = 28,
|
|||
}
|
||||
}
|
||||
|
||||
var serializer = (IStringSerializer)new SerializerFactory().Build(calendar.GetType(), new SerializationContext());
|
||||
var icalendar = serializer.SerializeToString(calendar);
|
||||
var serializer = new SerializerFactory().Build(calendar.GetType(), new SerializationContext()) as IStringSerializer;
|
||||
var icalendar = serializer?.SerializeToString(calendar);
|
||||
|
||||
return TypedResults.Content(icalendar, "text/calendar");
|
||||
return icalendar is null ? TypedResults.NoContent() : TypedResults.Content(icalendar, "text/calendar");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentValidation" Version="9.5.4" />
|
||||
<PackageReference Include="Ical.Net" Version="4.3.1" />
|
||||
<PackageReference Include="Ical.Net" Version="5.2.1" />
|
||||
<PackageReference Include="NLog" Version="5.5.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="10.1.7" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in a new issue