mirror of https://github.com/jellyfin/jellyfin.git
fix merge
This commit is contained in:
parent
cbcf3bfaff
commit
fee07219d0
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Jellyfin.Api.Extensions;
|
||||||
using Jellyfin.Api.Helpers;
|
using Jellyfin.Api.Helpers;
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Dto;
|
using MediaBrowser.Controller.Dto;
|
||||||
|
@ -130,7 +131,8 @@ namespace Jellyfin.Api.Controllers
|
||||||
ChannelIds = new[] { channelId },
|
ChannelIds = new[] { channelId },
|
||||||
ParentId = folderId ?? Guid.Empty,
|
ParentId = folderId ?? Guid.Empty,
|
||||||
OrderBy = RequestHelpers.GetOrderBy(sortBy, sortOrder),
|
OrderBy = RequestHelpers.GetOrderBy(sortBy, sortOrder),
|
||||||
DtoOptions = new DtoOptions { Fields = RequestHelpers.GetItemFields(fields) }
|
DtoOptions = new DtoOptions()
|
||||||
|
.AddItemFields(fields)
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var filter in RequestHelpers.GetFilters(filters))
|
foreach (var filter in RequestHelpers.GetFilters(filters))
|
||||||
|
@ -206,7 +208,8 @@ namespace Jellyfin.Api.Controllers
|
||||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||||
.Select(i => new Guid(i))
|
.Select(i => new Guid(i))
|
||||||
.ToArray(),
|
.ToArray(),
|
||||||
DtoOptions = new DtoOptions { Fields = RequestHelpers.GetItemFields(fields) }
|
DtoOptions = new DtoOptions()
|
||||||
|
.AddItemFields(fields)
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var filter in RequestHelpers.GetFilters(filters))
|
foreach (var filter in RequestHelpers.GetFilters(filters))
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace Jellyfin.Api.Extensions
|
||||||
/// <param name="dtoOptions">DtoOptions object.</param>
|
/// <param name="dtoOptions">DtoOptions object.</param>
|
||||||
/// <param name="fields">Comma delimited string of fields.</param>
|
/// <param name="fields">Comma delimited string of fields.</param>
|
||||||
/// <returns>Modified DtoOptions object.</returns>
|
/// <returns>Modified DtoOptions object.</returns>
|
||||||
internal static DtoOptions AddItemFields(this DtoOptions dtoOptions, string fields)
|
internal static DtoOptions AddItemFields(this DtoOptions dtoOptions, string? fields)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(fields))
|
if (string.IsNullOrEmpty(fields))
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Jellyfin.Data.Enums;
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Querying;
|
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Controller.Session;
|
using MediaBrowser.Controller.Session;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Querying;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
namespace Jellyfin.Api.Helpers
|
namespace Jellyfin.Api.Helpers
|
||||||
|
@ -55,29 +55,6 @@ namespace Jellyfin.Api.Helpers
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the item fields.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fields">The fields.</param>
|
|
||||||
/// <returns>IEnumerable{ItemFields}.</returns>
|
|
||||||
public static ItemFields[] GetItemFields(string? fields)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(fields))
|
|
||||||
{
|
|
||||||
return Array.Empty<ItemFields>();
|
|
||||||
}
|
|
||||||
|
|
||||||
return fields.Split(',').Select(v =>
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(v, true, out ItemFields value))
|
|
||||||
{
|
|
||||||
return (ItemFields?)value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}).Where(i => i.HasValue).Select(i => i!.Value).ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get parsed filters.
|
/// Get parsed filters.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue