Merge pull request #4304 from crobibero/query-location-type

Convert exclude location type string to enum.
This commit is contained in:
dkanada 2020-10-11 18:32:22 +09:00 committed by GitHub
commit 4fafa5796d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -159,7 +159,7 @@ namespace Jellyfin.Api.Controllers
[FromQuery] bool? isHd,
[FromQuery] bool? is4K,
[FromQuery] string? locationTypes,
[FromQuery] string? excludeLocationTypes,
[FromQuery] LocationType[] excludeLocationTypes,
[FromQuery] bool? isMissing,
[FromQuery] bool? isUnaired,
[FromQuery] double? minCommunityRating,
@ -406,13 +406,10 @@ namespace Jellyfin.Api.Controllers
}
// ExcludeLocationTypes
if (!string.IsNullOrEmpty(excludeLocationTypes))
{
if (excludeLocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray().Contains(LocationType.Virtual))
if (excludeLocationTypes.Any(t => t == LocationType.Virtual))
{
query.IsVirtualItem = false;
}
}
if (!string.IsNullOrEmpty(locationTypes))
{

View File

@ -1,6 +1,7 @@
using System;
using Jellyfin.Api.Constants;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
@ -124,7 +125,7 @@ namespace Jellyfin.Api.Controllers
[FromQuery] bool? isHd,
[FromQuery] bool? is4K,
[FromQuery] string? locationTypes,
[FromQuery] string? excludeLocationTypes,
[FromQuery] LocationType[] excludeLocationTypes,
[FromQuery] bool? isMissing,
[FromQuery] bool? isUnaired,
[FromQuery] double? minCommunityRating,