diff --git a/Jellyfin.Api/Controllers/GenresController.cs b/Jellyfin.Api/Controllers/GenresController.cs
index 94c1b4b9ee..4e47658b06 100644
--- a/Jellyfin.Api/Controllers/GenresController.cs
+++ b/Jellyfin.Api/Controllers/GenresController.cs
@@ -66,7 +66,6 @@ namespace Jellyfin.Api.Controllers
/// Genres returned.
/// An containing the queryresult of genres.
[HttpGet]
- [HttpGet("/MusicGenres", Name = "GetMusicGenres-Deprecated")]
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult> GetGenres(
[FromQuery] int? startIndex,
diff --git a/Jellyfin.Api/Controllers/MusicGenresController.cs b/Jellyfin.Api/Controllers/MusicGenresController.cs
index 28295f0cbf..24075b9052 100644
--- a/Jellyfin.Api/Controllers/MusicGenresController.cs
+++ b/Jellyfin.Api/Controllers/MusicGenresController.cs
@@ -44,6 +44,88 @@ namespace Jellyfin.Api.Controllers
_dtoService = dtoService;
}
+ ///
+ /// Gets all music genres from a given item, folder, or the entire library.
+ ///
+ /// Optional. The record index to start at. All items with a lower index will be dropped from the results.
+ /// Optional. The maximum number of records to return.
+ /// The search term.
+ /// Specify this to localize the search to a specific item or folder. Omit to use the root.
+ /// 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.
+ /// Optional. If specified, results will be filtered out based on item type. This allows multiple, comma delimited.
+ /// Optional. If specified, results will be filtered in based on item type. This allows multiple, comma delimited.
+ /// Optional filter by items that are marked as favorite, or not.
+ /// Optional, the max number of images to return, per image type.
+ /// Optional. The image types to include in the output.
+ /// User id.
+ /// Optional filter by items whose name is sorted equally or greater than a given input string.
+ /// Optional filter by items whose name is sorted equally than a given input string.
+ /// Optional filter by items whose name is equally or lesser than a given input string.
+ /// Optional, include image information in output.
+ /// Optional. Include total record count.
+ /// Music genres returned.
+ /// An containing the queryresult of music genres.
+ [HttpGet]
+ public ActionResult> GetMusicGenres(
+ [FromQuery] int? startIndex,
+ [FromQuery] int? limit,
+ [FromQuery] string? searchTerm,
+ [FromQuery] string? parentId,
+ [FromQuery] string? fields,
+ [FromQuery] string? excludeItemTypes,
+ [FromQuery] string? includeItemTypes,
+ [FromQuery] bool? isFavorite,
+ [FromQuery] int? imageTypeLimit,
+ [FromQuery] ImageType[] enableImageTypes,
+ [FromQuery] Guid? userId,
+ [FromQuery] string? nameStartsWithOrGreater,
+ [FromQuery] string? nameStartsWith,
+ [FromQuery] string? nameLessThan,
+ [FromQuery] bool? enableImages = true,
+ [FromQuery] bool enableTotalRecordCount = true)
+ {
+ var dtoOptions = new DtoOptions()
+ .AddItemFields(fields)
+ .AddClientFields(Request)
+ .AddAdditionalDtoOptions(enableImages, false, imageTypeLimit, enableImageTypes);
+
+ User? user = userId.HasValue && userId != Guid.Empty ? _userManager.GetUserById(userId.Value) : null;
+
+ var parentItem = _libraryManager.GetParentItem(parentId, userId);
+
+ var query = new InternalItemsQuery(user)
+ {
+ ExcludeItemTypes = RequestHelpers.Split(excludeItemTypes, ',', true),
+ IncludeItemTypes = RequestHelpers.Split(includeItemTypes, ',', true),
+ StartIndex = startIndex,
+ Limit = limit,
+ IsFavorite = isFavorite,
+ NameLessThan = nameLessThan,
+ NameStartsWith = nameStartsWith,
+ NameStartsWithOrGreater = nameStartsWithOrGreater,
+ DtoOptions = dtoOptions,
+ SearchTerm = searchTerm,
+ EnableTotalRecordCount = enableTotalRecordCount
+ };
+
+ if (!string.IsNullOrWhiteSpace(parentId))
+ {
+ if (parentItem is Folder)
+ {
+ query.AncestorIds = new[] { new Guid(parentId) };
+ }
+ else
+ {
+ query.ItemIds = new[] { new Guid(parentId) };
+ }
+ }
+
+ var result = _libraryManager.GetMusicGenres(query);
+
+ var shouldIncludeItemTypes = !string.IsNullOrWhiteSpace(includeItemTypes);
+ return RequestHelpers.CreateQueryResult(result, dtoOptions, _dtoService, shouldIncludeItemTypes, user);
+ }
+
///
/// Gets a music genre, by name.
///
diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
index f0270e9935..e180d0cd7a 100644
--- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
+++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
@@ -260,7 +260,6 @@ namespace Jellyfin.Server.Extensions
c.AddSwaggerTypeMappings();
c.OperationFilter();
- c.OperationFilter();
c.DocumentFilter();
});
}
diff --git a/Jellyfin.Server/Filters/ObsoleteRoutesFilter.cs b/Jellyfin.Server/Filters/ObsoleteRoutesFilter.cs
deleted file mode 100644
index 34cd72752a..0000000000
--- a/Jellyfin.Server/Filters/ObsoleteRoutesFilter.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using Microsoft.AspNetCore.Mvc.Controllers;
-using Microsoft.OpenApi.Models;
-using Swashbuckle.AspNetCore.SwaggerGen;
-
-namespace Jellyfin.Server.Filters
-{
- ///
- public class ObsoleteRoutesFilter : IOperationFilter
- {
- ///
- public void Apply(OpenApiOperation operation, OperationFilterContext context)
- {
- if (context.ApiDescription.ActionDescriptor is ControllerActionDescriptor actionDescriptor
- && !string.IsNullOrEmpty(actionDescriptor.AttributeRouteInfo.Name)
- && actionDescriptor.AttributeRouteInfo.Name.EndsWith("deprecated", StringComparison.OrdinalIgnoreCase))
- {
- operation.Deprecated = true;
- }
- }
- }
-}