From 6fd79fb01597b5132ca5b3bd9c06c92d527ee0cc Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Tue, 23 Jul 2024 11:34:41 -0600 Subject: Fix up getting livetv programs api docs --- Jellyfin.Api/Controllers/LiveTvController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Jellyfin.Api/Controllers/LiveTvController.cs') diff --git a/Jellyfin.Api/Controllers/LiveTvController.cs b/Jellyfin.Api/Controllers/LiveTvController.cs index 2b26c01f8..a15ff0f52 100644 --- a/Jellyfin.Api/Controllers/LiveTvController.cs +++ b/Jellyfin.Api/Controllers/LiveTvController.cs @@ -656,7 +656,7 @@ public class LiveTvController : BaseJellyfinApiController var query = new InternalItemsQuery(user) { - ChannelIds = body.ChannelIds, + ChannelIds = body.ChannelIds ?? [], HasAired = body.HasAired, IsAiring = body.IsAiring, EnableTotalRecordCount = body.EnableTotalRecordCount, @@ -666,15 +666,15 @@ public class LiveTvController : BaseJellyfinApiController MaxEndDate = body.MaxEndDate, StartIndex = body.StartIndex, Limit = body.Limit, - OrderBy = RequestHelpers.GetOrderBy(body.SortBy, body.SortOrder), + OrderBy = RequestHelpers.GetOrderBy(body.SortBy ?? [], body.SortOrder ?? []), IsNews = body.IsNews, IsMovie = body.IsMovie, IsSeries = body.IsSeries, IsKids = body.IsKids, IsSports = body.IsSports, SeriesTimerId = body.SeriesTimerId, - Genres = body.Genres, - GenreIds = body.GenreIds + Genres = body.Genres ?? [], + GenreIds = body.GenreIds ?? [] }; if (!body.LibrarySeriesId.IsEmpty()) @@ -690,7 +690,7 @@ public class LiveTvController : BaseJellyfinApiController var dtoOptions = new DtoOptions { Fields = body.Fields } .AddClientFields(User) - .AddAdditionalDtoOptions(body.EnableImages, body.EnableUserData, body.ImageTypeLimit, body.EnableImageTypes); + .AddAdditionalDtoOptions(body.EnableImages, body.EnableUserData, body.ImageTypeLimit, body.EnableImageTypes ?? []); return await _liveTvManager.GetPrograms(query, dtoOptions, CancellationToken.None).ConfigureAwait(false); } -- cgit v1.2.3 From 4f746c40d7ffd0d4be46531a057bf6daed121bd8 Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Thu, 25 Jul 2024 11:18:25 -0600 Subject: suggestions from review --- Jellyfin.Api/Controllers/LiveTvController.cs | 4 ++-- Jellyfin.Api/Models/LiveTvDtos/GetProgramsDto.cs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'Jellyfin.Api/Controllers/LiveTvController.cs') diff --git a/Jellyfin.Api/Controllers/LiveTvController.cs b/Jellyfin.Api/Controllers/LiveTvController.cs index a15ff0f52..0cf36f57e 100644 --- a/Jellyfin.Api/Controllers/LiveTvController.cs +++ b/Jellyfin.Api/Controllers/LiveTvController.cs @@ -677,11 +677,11 @@ public class LiveTvController : BaseJellyfinApiController GenreIds = body.GenreIds ?? [] }; - if (!body.LibrarySeriesId.IsEmpty()) + if (!body.LibrarySeriesId.IsNullOrEmpty()) { query.IsSeries = true; - var series = _libraryManager.GetItemById(body.LibrarySeriesId); + var series = _libraryManager.GetItemById(body.LibrarySeriesId.Value); if (series is not null) { query.Name = series.Name; diff --git a/Jellyfin.Api/Models/LiveTvDtos/GetProgramsDto.cs b/Jellyfin.Api/Models/LiveTvDtos/GetProgramsDto.cs index 633729c11..7210cc8f7 100644 --- a/Jellyfin.Api/Models/LiveTvDtos/GetProgramsDto.cs +++ b/Jellyfin.Api/Models/LiveTvDtos/GetProgramsDto.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Text.Json.Serialization; using Jellyfin.Data.Enums; using Jellyfin.Extensions.Json.Converters; @@ -121,6 +122,7 @@ public class GetProgramsDto /// /// Gets or sets a value indicating whether retrieve total record count. /// + [DefaultValue(true)] public bool EnableTotalRecordCount { get; set; } = true; /// @@ -147,7 +149,7 @@ public class GetProgramsDto /// /// Gets or sets filter by library series id. /// - public Guid LibrarySeriesId { get; set; } + public Guid? LibrarySeriesId { get; set; } /// /// Gets or sets specify additional fields of information to return in the output. -- cgit v1.2.3