The Free Software Media System - Server Backend & API
Merge remote-tracking branch 'upstream/master' into query-fields
crobibero6748ba287d8c
diff --cc Jellyfin.Api/Controllers/GenresController.csindex 981cc8eda0,4e47658b06..a273c33dcb--- a/Jellyfin.Api/Controllers/GenresController.cs+++ b/Jellyfin.Api/Controllers/GenresController.cs@@@ -54,25 -51,12 +51,12 @@@ namespace Jellyfin.Api.Controller/// <param name="limit">Optional. The maximum number of records to return.</param>/// <param name="searchTerm">The search term.</param>/// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>- /// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>+ /// <param name="fields">Optional. Specify additional fields of information to return in the output.</param>/// <param name="excludeItemTypes">Optional. If specified, results will be filtered out based on item type. This allows multiple, comma delimited.</param>/// <param name="includeItemTypes">Optional. If specified, results will be filtered in based on item type. This allows multiple, comma delimited.</param>- /// <param name="filters">Optional. Specify additional filters to apply.</param>/// <param name="isFavorite">Optional filter by items that are marked as favorite, or not.</param>- /// <param name="mediaTypes">Optional filter by MediaType. Allows multiple, comma delimited.</param>- /// <param name="genres">Optional. If specified, results will be filtered based on genre. This allows multiple, pipe delimited.</param>- /// <param name="genreIds">Optional. If specified, results will be filtered based on genre id. This allows multiple, pipe delimited.</param>- /// <param name="officialRatings">Optional. If specified, results will be filtered based on OfficialRating. This allows multiple, pipe delimited.</param>- /// <param name="tags">Optional. If specified, results will be filtered based on tag. This allows multiple, pipe delimited.</param>- /// <param name="years">Optional. If specified, results will be filtered based on production year. This allows multiple, comma delimited.</param>- /// <param name="enableUserData">Optional, include user data.</param>/// <param name="imageTypeLimit">Optional, the max number of images to return, per image type.</param>/// <param name="enableImageTypes">Optional. The image types to include in the output.</param>- /// <param name="person">Optional. If specified, results will be filtered to include only those containing the specified person.</param>- /// <param name="personIds">Optional. If specified, results will be filtered to include only those containing the specified person id.</param>- /// <param name="personTypes">Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType. Allows multiple, comma-delimited.</param>- /// <param name="studios">Optional. If specified, results will be filtered based on studio. This allows multiple, pipe delimited.</param>- /// <param name="studioIds">Optional. If specified, results will be filtered based on studio id. This allows multiple, pipe delimited.</param>/// <param name="userId">User id.</param>/// <param name="nameStartsWithOrGreater">Optional filter by items whose name is sorted equally or greater than a given input string.</param>/// <param name="nameStartsWith">Optional filter by items whose name is sorted equally than a given input string.</param>@@@ -89,25 -72,12 +72,12 @@@[FromQuery] int? limit,[FromQuery] string? searchTerm,[FromQuery] string? parentId,- [FromQuery] string? fields,+ [FromQuery] ItemFields[] fields,[FromQuery] string? excludeItemTypes,[FromQuery] string? includeItemTypes,- [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,[FromQuery] bool? isFavorite,- [FromQuery] string? mediaTypes,- [FromQuery] string? genres,- [FromQuery] string? genreIds,- [FromQuery] string? officialRatings,- [FromQuery] string? tags,- [FromQuery] string? years,- [FromQuery] bool? enableUserData,[FromQuery] int? imageTypeLimit,[FromQuery] ImageType[] enableImageTypes,- [FromQuery] string? person,- [FromQuery] string? personIds,- [FromQuery] string? personTypes,- [FromQuery] string? studios,- [FromQuery] string? studioIds,[FromQuery] Guid? userId,[FromQuery] string? nameStartsWithOrGreater,[FromQuery] string? nameStartsWith,@@@ -115,22 -85,14 +85,13 @@@[FromQuery] bool? enableImages = true,[FromQuery] bool enableTotalRecordCount = true){- var dtoOptions = new DtoOptions()- .AddItemFields(fields)+ var dtoOptions = new DtoOptions { Fields = fields }.AddClientFields(Request)- .AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);+ .AddAdditionalDtoOptions(enableImages, false, imageTypeLimit, enableImageTypes);- User? user = null;- BaseItem parentItem;+ User? user = userId.HasValue && userId != Guid.Empty ? _userManager.GetUserById(userId.Value) : null;- if (userId.HasValue && !userId.Equals(Guid.Empty))- {- user = _userManager.GetUserById(userId.Value);- parentItem = string.IsNullOrEmpty(parentId) ? _libraryManager.GetUserRootFolder() : _libraryManager.GetItemById(parentId);- }- else- {- parentItem = string.IsNullOrEmpty(parentId) ? _libraryManager.RootFolder : _libraryManager.GetItemById(parentId);- }+ var parentItem = _libraryManager.GetParentItem(parentId, userId);var query = new InternalItemsQuery(user){diff --cc Jellyfin.Api/Controllers/MusicGenresController.csindex 2246ea45af,e105befe8e..1af3bbccc9--- a/Jellyfin.Api/Controllers/MusicGenresController.cs+++ b/Jellyfin.Api/Controllers/MusicGenresController.cs@@@ -54,25 -51,12 +51,12 @@@ namespace Jellyfin.Api.Controller/// <param name="limit">Optional. The maximum number of records to return.</param>/// <param name="searchTerm">The search term.</param>/// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>- /// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>+ /// <param name="fields">Optional. Specify additional fields of information to return in the output.</param>/// <param name="excludeItemTypes">Optional. If specified, results will be filtered out based on item type. This allows multiple, comma delimited.</param>/// <param name="includeItemTypes">Optional. If specified, results will be filtered in based on item type. This allows multiple, comma delimited.</param>- /// <param name="filters">Optional. Specify additional filters to apply.</param>/// <param name="isFavorite">Optional filter by items that are marked as favorite, or not.</param>- /// <param name="mediaTypes">Optional filter by MediaType. Allows multiple, comma delimited.</param>- /// <param name="genres">Optional. If specified, results will be filtered based on genre. This allows multiple, pipe delimited.</param>- /// <param name="genreIds">Optional. If specified, results will be filtered based on genre id. This allows multiple, pipe delimited.</param>- /// <param name="officialRatings">Optional. If specified, results will be filtered based on OfficialRating. This allows multiple, pipe delimited.</param>- /// <param name="tags">Optional. If specified, results will be filtered based on tag. This allows multiple, pipe delimited.</param>- /// <param name="years">Optional. If specified, results will be filtered based on production year. This allows multiple, comma delimited.</param>- /// <param name="enableUserData">Optional, include user data.</param>/// <param name="imageTypeLimit">Optional, the max number of images to return, per image type.</param>/// <param name="enableImageTypes">Optional. The image types to include in the output.</param>- /// <param name="person">Optional. If specified, results will be filtered to include only those containing the specified person.</param>- /// <param name="personIds">Optional. If specified, results will be filtered to include only those containing the specified person id.</param>- /// <param name="personTypes">Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType. Allows multiple, comma-delimited.</param>- /// <param name="studios">Optional. If specified, results will be filtered based on studio. This allows multiple, pipe delimited.</param>- /// <param name="studioIds">Optional. If specified, results will be filtered based on studio id. This allows multiple, pipe delimited.</param>/// <param name="userId">User id.</param>/// <param name="nameStartsWithOrGreater">Optional filter by items whose name is sorted equally or greater than a given input string.</param>/// <param name="nameStartsWith">Optional filter by items whose name is sorted equally than a given input string.</param>@@@ -88,25 -72,12 +72,12 @@@[FromQuery] int? limit,[FromQuery] string? searchTerm,[FromQuery] string? parentId,- [FromQuery] string? fields,+ [FromQuery] ItemFields[] fields,[FromQuery] string? excludeItemTypes,[FromQuery] string? includeItemTypes,- [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,[FromQuery] bool? isFavorite,- [FromQuery] string? mediaTypes,- [FromQuery] string? genres,- [FromQuery] string? genreIds,- [FromQuery] string? officialRatings,- [FromQuery] string? tags,- [FromQuery] string? years,- [FromQuery] bool? enableUserData,[FromQuery] int? imageTypeLimit,[FromQuery] ImageType[] enableImageTypes,- [FromQuery] string? person,- [FromQuery] string? personIds,- [FromQuery] string? personTypes,- [FromQuery] string? studios,- [FromQuery] string? studioIds,[FromQuery] Guid? userId,[FromQuery] string? nameStartsWithOrGreater,[FromQuery] string? nameStartsWith,@@@ -114,22 -85,14 +85,13 @@@[FromQuery] bool? enableImages = true,[FromQuery] bool enableTotalRecordCount = true){- var dtoOptions = new DtoOptions()- .AddItemFields(fields)+ var dtoOptions = new DtoOptions { Fields = fields }.AddClientFields(Request)- .AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);+ .AddAdditionalDtoOptions(enableImages, false, imageTypeLimit, enableImageTypes);- User? user = null;- BaseItem parentItem;+ User? user = userId.HasValue && userId != Guid.Empty ? _userManager.GetUserById(userId.Value) : null;- if (userId.HasValue && !userId.Equals(Guid.Empty))- {- user = _userManager.GetUserById(userId.Value);- parentItem = string.IsNullOrEmpty(parentId) ? _libraryManager.GetUserRootFolder() : _libraryManager.GetItemById(parentId);- }- else- {- parentItem = string.IsNullOrEmpty(parentId) ? _libraryManager.RootFolder : _libraryManager.GetItemById(parentId);- }+ var parentItem = _libraryManager.GetParentItem(parentId, userId);var query = new InternalItemsQuery(user){diff --cc Jellyfin.Api/Controllers/PersonsController.csindex 6b6448f60e,1e0bdb6bc7..fcba75e67b--- a/Jellyfin.Api/Controllers/PersonsController.cs+++ b/Jellyfin.Api/Controllers/PersonsController.cs@@@ -46,24 -49,13 +49,13 @@@ namespace Jellyfin.Api.Controller}/// <summary>- /// Gets all persons from a given item, folder, or the entire library.+ /// Gets all persons./// </summary>- /// <param name="minCommunityRating">Optional filter by minimum community rating.</param>- /// <param name="startIndex">Optional. The record index to start at. All items with a lower index will be dropped from the results.</param>/// <param name="limit">Optional. The maximum number of records to return.</param>/// <param name="searchTerm">The search term.</param>- /// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>- /// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>+ /// <param name="fields">Optional. Specify additional fields of information to return in the output.</param>- /// <param name="excludeItemTypes">Optional. If specified, results will be filtered out based on item type. This allows multiple, comma delimited.</param>- /// <param name="includeItemTypes">Optional. If specified, results will be filtered in based on item type. This allows multiple, comma delimited.</param>/// <param name="filters">Optional. Specify additional filters to apply. This allows multiple, comma delimited. Options: IsFolder, IsNotFolder, IsUnplayed, IsPlayed, IsFavorite, IsResumable, Likes, Dislikes.</param>- /// <param name="isFavorite">Optional filter by items that are marked as favorite, or not.</param>- /// <param name="mediaTypes">Optional filter by MediaType. Allows multiple, comma delimited.</param>- /// <param name="genres">Optional. If specified, results will be filtered based on genre. This allows multiple, pipe delimited.</param>- /// <param name="genreIds">Optional. If specified, results will be filtered based on genre id. This allows multiple, pipe delimited.</param>- /// <param name="officialRatings">Optional. If specified, results will be filtered based on OfficialRating. This allows multiple, pipe delimited.</param>- /// <param name="tags">Optional. If specified, results will be filtered based on tag. This allows multiple, pipe delimited.</param>- /// <param name="years">Optional. If specified, results will be filtered based on production year. This allows multiple, comma delimited.</param>+ /// <param name="isFavorite">Optional filter by items that are marked as favorite, or not. userId is required.</param>/// <param name="enableUserData">Optional, include user data.</param>/// <param name="imageTypeLimit">Optional, the max number of images to return, per image type.</param>/// <param name="enableImageTypes">Optional. The image types to include in the output.</param>@@@ -83,38 -69,22 +69,21 @@@[HttpGet][ProducesResponseType(StatusCodes.Status200OK)]public ActionResult<QueryResult<BaseItemDto>> GetPersons(- [FromQuery] double? minCommunityRating,- [FromQuery] int? startIndex,[FromQuery] int? limit,[FromQuery] string? searchTerm,- [FromQuery] string? parentId,- [FromQuery] string? fields,+ [FromQuery] ItemFields[] fields,- [FromQuery] string? excludeItemTypes,- [FromQuery] string? includeItemTypes,[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,[FromQuery] bool? isFavorite,- [FromQuery] string? mediaTypes,- [FromQuery] string? genres,- [FromQuery] string? genreIds,- [FromQuery] string? officialRatings,- [FromQuery] string? tags,- [FromQuery] string? years,[FromQuery] bool? enableUserData,[FromQuery] int? imageTypeLimit,[FromQuery] ImageType[] enableImageTypes,- [FromQuery] string? person,- [FromQuery] string? personIds,+ [FromQuery] string? excludePersonTypes,[FromQuery] string? personTypes,- [FromQuery] string? studios,- [FromQuery] string? studioIds,+ [FromQuery] string? appearsInItemId,[FromQuery] Guid? userId,- [FromQuery] string? nameStartsWithOrGreater,- [FromQuery] string? nameStartsWith,- [FromQuery] string? nameLessThan,- [FromQuery] bool? enableImages = true,- [FromQuery] bool enableTotalRecordCount = true)+ [FromQuery] bool? enableImages = true){- var dtoOptions = new DtoOptions()- .AddItemFields(fields)+ var dtoOptions = new DtoOptions { Fields = fields }.AddClientFields(Request).AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);diff --cc Jellyfin.Api/Controllers/StudiosController.csindex 852c0826c6,c5fcfb3569..bda1c0b2f3--- a/Jellyfin.Api/Controllers/StudiosController.cs+++ b/Jellyfin.Api/Controllers/StudiosController.cs@@@ -52,17 -49,10 +49,10 @@@ namespace Jellyfin.Api.Controller/// <param name="limit">Optional. The maximum number of records to return.</param>/// <param name="searchTerm">Optional. Search term.</param>/// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>- /// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>+ /// <param name="fields">Optional. Specify additional fields of information to return in the output.</param>/// <param name="excludeItemTypes">Optional. If specified, results will be filtered out based on item type. This allows multiple, comma delimited.</param>/// <param name="includeItemTypes">Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimited.</param>- /// <param name="filters">Optional. Specify additional filters to apply.</param>/// <param name="isFavorite">Optional filter by items that are marked as favorite, or not.</param>- /// <param name="mediaTypes">Optional filter by MediaType. Allows multiple, comma delimited.</param>- /// <param name="genres">Optional. If specified, results will be filtered based on genre. This allows multiple, pipe delimited.</param>- /// <param name="genreIds">Optional. If specified, results will be filtered based on genre id. This allows multiple, pipe delimited.</param>- /// <param name="officialRatings">Optional. If specified, results will be filtered based on OfficialRating. This allows multiple, pipe delimited.</param>- /// <param name="tags">Optional. If specified, results will be filtered based on tag. This allows multiple, pipe delimited.</param>- /// <param name="years">Optional. If specified, results will be filtered based on production year. This allows multiple, comma delimited.</param>/// <param name="enableUserData">Optional, include user data.</param>/// <param name="imageTypeLimit">Optional, the max number of images to return, per image type.</param>/// <param name="enableImageTypes">Optional. The image types to include in the output.</param>@@@ -87,17 -71,10 +71,10 @@@[FromQuery] int? limit,[FromQuery] string? searchTerm,[FromQuery] string? parentId,- [FromQuery] string? fields,+ [FromQuery] ItemFields[] fields,[FromQuery] string? excludeItemTypes,[FromQuery] string? includeItemTypes,- [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFilter[] filters,[FromQuery] bool? isFavorite,- [FromQuery] string? mediaTypes,- [FromQuery] string? genres,- [FromQuery] string? genreIds,- [FromQuery] string? officialRatings,- [FromQuery] string? tags,- [FromQuery] string? years,[FromQuery] bool? enableUserData,[FromQuery] int? imageTypeLimit,[FromQuery] ImageType[] enableImageTypes,