mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-13 20:44:52 -04:00
New: Release type options for Calendar Feed
This commit is contained in:
@@ -208,6 +208,7 @@
|
||||
"ChownGroup": "chown Group",
|
||||
"ChownGroupHelpText": "Group name or gid. Use gid for remote file systems.",
|
||||
"ChownGroupHelpTextWarning": "This only works if the user running {appName} is the owner of the file. It's better to ensure the download client uses the same group as {appName}.",
|
||||
"CinemaRelease": "Cinema Release",
|
||||
"CleanLibraryLevel": "Clean Library Level",
|
||||
"Clear": "Clear",
|
||||
"ClearBlocklist": "Clear blocklist",
|
||||
@@ -755,6 +756,8 @@
|
||||
"ICalFeedHelpText": "Copy this URL to your client(s) or click to subscribe if your browser supports webcal",
|
||||
"ICalIncludeUnmonitoredMoviesHelpText": "Include unmonitored movies in the iCal feed",
|
||||
"ICalLink": "iCal Link",
|
||||
"ICalReleaseTypes": "Release Types",
|
||||
"ICalReleaseTypesMoviesHelpText": "Include only movies with specific release types in the iCal feed. If unspecified, all options are used.",
|
||||
"ICalShowAsAllDayEvents": "Show as All-Day Events",
|
||||
"ICalShowAsAllDayEventsHelpText": "Events will appear as all-day events in your calendar",
|
||||
"ICalTagsMoviesHelpText": "Applies to movies with at least one matching tag",
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Radarr.Api.V3.Calendar
|
||||
}
|
||||
|
||||
[HttpGet("Radarr.ics")]
|
||||
public IActionResult GetCalendarFeed(int pastDays = 7, int futureDays = 28, string tags = "", bool unmonitored = false)
|
||||
public IActionResult GetCalendarFeed(int pastDays = 7, int futureDays = 28, string tags = "", bool unmonitored = false, IReadOnlyCollection<CalendarReleaseType> releaseTypes = null)
|
||||
{
|
||||
var start = DateTime.Today.AddDays(-pastDays);
|
||||
var end = DateTime.Today.AddDays(futureDays);
|
||||
@@ -54,9 +54,20 @@ namespace Radarr.Api.V3.Calendar
|
||||
continue;
|
||||
}
|
||||
|
||||
CreateEvent(calendar, movie.MovieMetadata, "cinematic");
|
||||
CreateEvent(calendar, movie.MovieMetadata, "digital");
|
||||
CreateEvent(calendar, movie.MovieMetadata, "physical");
|
||||
if (releaseTypes is not { Count: not 0 } || releaseTypes.Contains(CalendarReleaseType.CinemaRelease))
|
||||
{
|
||||
CreateEvent(calendar, movie.MovieMetadata, "cinematic");
|
||||
}
|
||||
|
||||
if (releaseTypes is not { Count: not 0 } || releaseTypes.Contains(CalendarReleaseType.DigitalRelease))
|
||||
{
|
||||
CreateEvent(calendar, movie.MovieMetadata, "digital");
|
||||
}
|
||||
|
||||
if (releaseTypes is not { Count: not 0 } || releaseTypes.Contains(CalendarReleaseType.PhysicalRelease))
|
||||
{
|
||||
CreateEvent(calendar, movie.MovieMetadata, "physical");
|
||||
}
|
||||
}
|
||||
|
||||
var serializer = (IStringSerializer)new SerializerFactory().Build(calendar.GetType(), new SerializationContext());
|
||||
@@ -98,9 +109,9 @@ namespace Radarr.Api.V3.Calendar
|
||||
occurrence.IsAllDay = true;
|
||||
|
||||
occurrence.Description = movie.Overview;
|
||||
occurrence.Categories = new List<string>() { movie.Studio };
|
||||
occurrence.Categories = new List<string> { movie.Studio };
|
||||
|
||||
occurrence.Summary = $"{movie.Title} " + summaryText;
|
||||
occurrence.Summary = $"{movie.Title} {summaryText}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
8
src/Radarr.Api.V3/Calendar/CalendarReleaseType.cs
Normal file
8
src/Radarr.Api.V3/Calendar/CalendarReleaseType.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Radarr.Api.V3.Calendar;
|
||||
|
||||
public enum CalendarReleaseType
|
||||
{
|
||||
CinemaRelease,
|
||||
DigitalRelease,
|
||||
PhysicalRelease
|
||||
}
|
||||
Reference in New Issue
Block a user