Fixed: Tag filtering on iCal feed

pull/5570/head
Mark McDowall 2 years ago
parent 7ed0407e77
commit a989c84260

@ -28,15 +28,15 @@ namespace Sonarr.Api.V3.Calendar
}
[HttpGet("Sonarr.ics")]
public IActionResult GetCalendarFeed(int pastDays = 7, int futureDays = 28, string tagList = "", bool unmonitored = false, bool premieresOnly = false, bool asAllDay = false)
public IActionResult GetCalendarFeed(int pastDays = 7, int futureDays = 28, string tags = "", bool unmonitored = false, bool premieresOnly = false, bool asAllDay = false)
{
var start = DateTime.Today.AddDays(-pastDays);
var end = DateTime.Today.AddDays(futureDays);
var tags = new List<int>();
var parsedTags = new List<int>();
if (tagList.IsNotNullOrWhiteSpace())
if (tags.IsNotNullOrWhiteSpace())
{
tags.AddRange(tagList.Split(',').Select(_tagService.GetTag).Select(t => t.Id));
parsedTags.AddRange(tags.Split(',').Select(_tagService.GetTag).Select(t => t.Id));
}
var episodes = _episodeService.EpisodesBetweenDates(start, end, unmonitored);
@ -59,7 +59,7 @@ namespace Sonarr.Api.V3.Calendar
continue;
}
if (tags.Any() && tags.None(series.Tags.Contains))
if (parsedTags.Any() && parsedTags.None(series.Tags.Contains))
{
continue;
}

Loading…
Cancel
Save