|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Jellyfin.Api.Constants;
|
|
|
|
|
using Jellyfin.Api.ModelBinders;
|
|
|
|
|
using MediaBrowser.Controller.Dto;
|
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
|
using MediaBrowser.Controller.Entities.Audio;
|
|
|
|
@ -50,8 +51,8 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
public ActionResult<QueryFiltersLegacy> GetQueryFiltersLegacy(
|
|
|
|
|
[FromQuery] Guid? userId,
|
|
|
|
|
[FromQuery] string? parentId,
|
|
|
|
|
[FromQuery] string? includeItemTypes,
|
|
|
|
|
[FromQuery] string? mediaTypes)
|
|
|
|
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] includeItemTypes,
|
|
|
|
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes)
|
|
|
|
|
{
|
|
|
|
|
var parentItem = string.IsNullOrEmpty(parentId)
|
|
|
|
|
? null
|
|
|
|
@ -61,10 +62,11 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
? _userManager.GetUserById(userId.Value)
|
|
|
|
|
: null;
|
|
|
|
|
|
|
|
|
|
if (string.Equals(includeItemTypes, nameof(BoxSet), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes, nameof(Playlist), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes, nameof(Trailer), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes, "Program", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (includeItemTypes.Length == 1
|
|
|
|
|
&& (string.Equals(includeItemTypes[0], nameof(BoxSet), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes[0], nameof(Playlist), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes[0], nameof(Trailer), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes[0], "Program", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
parentItem = null;
|
|
|
|
|
}
|
|
|
|
@ -78,8 +80,8 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
var query = new InternalItemsQuery
|
|
|
|
|
{
|
|
|
|
|
User = user,
|
|
|
|
|
MediaTypes = (mediaTypes ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries),
|
|
|
|
|
IncludeItemTypes = (includeItemTypes ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries),
|
|
|
|
|
MediaTypes = mediaTypes,
|
|
|
|
|
IncludeItemTypes = includeItemTypes,
|
|
|
|
|
Recursive = true,
|
|
|
|
|
EnableTotalRecordCount = false,
|
|
|
|
|
DtoOptions = new DtoOptions
|
|
|
|
@ -139,7 +141,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
public ActionResult<QueryFilters> GetQueryFilters(
|
|
|
|
|
[FromQuery] Guid? userId,
|
|
|
|
|
[FromQuery] string? parentId,
|
|
|
|
|
[FromQuery] string? includeItemTypes,
|
|
|
|
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] includeItemTypes,
|
|
|
|
|
[FromQuery] bool? isAiring,
|
|
|
|
|
[FromQuery] bool? isMovie,
|
|
|
|
|
[FromQuery] bool? isSports,
|
|
|
|
@ -156,10 +158,11 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
? _userManager.GetUserById(userId.Value)
|
|
|
|
|
: null;
|
|
|
|
|
|
|
|
|
|
if (string.Equals(includeItemTypes, nameof(BoxSet), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes, nameof(Playlist), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes, nameof(Trailer), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes, "Program", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (includeItemTypes.Length == 1
|
|
|
|
|
&& (string.Equals(includeItemTypes[0], nameof(BoxSet), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes[0], nameof(Playlist), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes[0], nameof(Trailer), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes[0], "Program", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
parentItem = null;
|
|
|
|
|
}
|
|
|
|
@ -167,8 +170,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
var filters = new QueryFilters();
|
|
|
|
|
var genreQuery = new InternalItemsQuery(user)
|
|
|
|
|
{
|
|
|
|
|
IncludeItemTypes =
|
|
|
|
|
(includeItemTypes ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries),
|
|
|
|
|
IncludeItemTypes = includeItemTypes,
|
|
|
|
|
DtoOptions = new DtoOptions
|
|
|
|
|
{
|
|
|
|
|
Fields = Array.Empty<ItemFields>(),
|
|
|
|
@ -192,10 +194,11 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
genreQuery.Parent = parentItem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.Equals(includeItemTypes, nameof(MusicAlbum), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes, nameof(MusicVideo), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes, nameof(MusicArtist), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes, nameof(Audio), StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (includeItemTypes.Length == 1
|
|
|
|
|
&& (string.Equals(includeItemTypes[0], nameof(MusicAlbum), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes[0], nameof(MusicVideo), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes[0], nameof(MusicArtist), StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| string.Equals(includeItemTypes[0], nameof(Audio), StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
filters.Genres = _libraryManager.GetMusicGenres(genreQuery).Items.Select(i => new NameGuidPair
|
|
|
|
|
{
|
|
|
|
|