fix merge

This commit is contained in:
crobibero 2020-06-24 10:54:25 -06:00
parent cbcf3bfaff
commit fee07219d0
3 changed files with 8 additions and 28 deletions

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Api.Extensions;
using Jellyfin.Api.Helpers;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Dto;
@ -130,7 +131,8 @@ namespace Jellyfin.Api.Controllers
ChannelIds = new[] { channelId },
ParentId = folderId ?? Guid.Empty,
OrderBy = RequestHelpers.GetOrderBy(sortBy, sortOrder),
DtoOptions = new DtoOptions { Fields = RequestHelpers.GetItemFields(fields) }
DtoOptions = new DtoOptions()
.AddItemFields(fields)
};
foreach (var filter in RequestHelpers.GetFilters(filters))
@ -206,7 +208,8 @@ namespace Jellyfin.Api.Controllers
.Where(i => !string.IsNullOrWhiteSpace(i))
.Select(i => new Guid(i))
.ToArray(),
DtoOptions = new DtoOptions { Fields = RequestHelpers.GetItemFields(fields) }
DtoOptions = new DtoOptions()
.AddItemFields(fields)
};
foreach (var filter in RequestHelpers.GetFilters(filters))

View File

@ -23,7 +23,7 @@ namespace Jellyfin.Api.Extensions
/// <param name="dtoOptions">DtoOptions object.</param>
/// <param name="fields">Comma delimited string of fields.</param>
/// <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))
{

View File

@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using Jellyfin.Data.Enums;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using Microsoft.AspNetCore.Http;
namespace Jellyfin.Api.Helpers
@ -55,29 +55,6 @@ namespace Jellyfin.Api.Helpers
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>
/// Get parsed filters.
/// </summary>