mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 02:18:54 -07:00
fixes #541 - ItemQuery returns incorrect UserData
This commit is contained in:
parent
b54240f679
commit
28e788e435
@ -45,7 +45,7 @@ namespace MediaBrowser.Api
|
||||
/// Fields to return within the items, in addition to basic information
|
||||
/// </summary>
|
||||
/// <value>The fields.</value>
|
||||
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, ItemCounts, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
public string Fields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -43,7 +43,7 @@ namespace MediaBrowser.Api
|
||||
/// Fields to return within the items, in addition to basic information
|
||||
/// </summary>
|
||||
/// <value>The fields.</value>
|
||||
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, ItemCounts, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
public string Fields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -48,7 +48,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
/// Fields to return within the items, in addition to basic information
|
||||
/// </summary>
|
||||
/// <value>The fields.</value>
|
||||
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, ItemCounts, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
public string Fields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -51,11 +51,6 @@ namespace MediaBrowser.Model.Querying
|
||||
/// </summary>
|
||||
HomePageUrl,
|
||||
|
||||
/// <summary>
|
||||
/// Child count, recursive child count, etc
|
||||
/// </summary>
|
||||
ItemCounts,
|
||||
|
||||
/// <summary>
|
||||
/// The fields that the server supports indexing on
|
||||
/// </summary>
|
||||
|
@ -107,13 +107,10 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.ItemCounts))
|
||||
var itemByName = item as IItemByName;
|
||||
if (itemByName != null)
|
||||
{
|
||||
var itemByName = item as IItemByName;
|
||||
if (itemByName != null)
|
||||
{
|
||||
AttachItemByNameCounts(dto, itemByName, user);
|
||||
}
|
||||
AttachItemByNameCounts(dto, itemByName, user);
|
||||
}
|
||||
|
||||
return dto;
|
||||
@ -166,18 +163,13 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
{
|
||||
if (item.IsFolder)
|
||||
{
|
||||
var hasItemCounts = fields.Contains(ItemFields.ItemCounts);
|
||||
var folder = (Folder)item;
|
||||
|
||||
if (hasItemCounts || fields.Contains(ItemFields.CumulativeRunTimeTicks))
|
||||
dto.ChildCount = folder.GetChildren(user, true).Count();
|
||||
|
||||
if (!(folder is UserRootFolder))
|
||||
{
|
||||
var folder = (Folder)item;
|
||||
|
||||
if (hasItemCounts)
|
||||
{
|
||||
dto.ChildCount = folder.GetChildren(user, true).Count();
|
||||
}
|
||||
|
||||
SetSpecialCounts(folder, user, dto);
|
||||
SetSpecialCounts(folder, user, dto, fields);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1068,8 +1060,9 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
/// <param name="folder">The folder.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <param name="dto">The dto.</param>
|
||||
/// <param name="fields">The fields.</param>
|
||||
/// <returns>Task.</returns>
|
||||
private void SetSpecialCounts(Folder folder, User user, BaseItemDto dto)
|
||||
private void SetSpecialCounts(Folder folder, User user, BaseItemDto dto, List<ItemFields> fields)
|
||||
{
|
||||
var rcentlyAddedItemCount = 0;
|
||||
var recursiveItemCount = 0;
|
||||
@ -1127,7 +1120,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
dto.PlayedPercentage = totalPercentPlayed / recursiveItemCount;
|
||||
}
|
||||
|
||||
if (runtime > 0)
|
||||
if (runtime > 0 && fields.Contains(ItemFields.CumulativeRunTimeTicks))
|
||||
{
|
||||
dto.CumulativeRunTimeTicks = runtime;
|
||||
}
|
||||
|
@ -356,6 +356,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
try
|
||||
{
|
||||
ProcessRequest(context);
|
||||
|
||||
var url = context.Request.Url.ToString();
|
||||
var endPoint = context.Request.RemoteEndPoint;
|
||||
|
||||
LogResponse(context, url, endPoint);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -433,9 +439,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
var httpRes = new HttpListenerResponseWrapper(context.Response);
|
||||
var handler = ServiceStackHttpHandlerFactory.GetHandler(httpReq);
|
||||
|
||||
var url = context.Request.Url.ToString();
|
||||
var endPoint = context.Request.RemoteEndPoint;
|
||||
|
||||
var serviceStackHandler = handler as IServiceStackHttpHandler;
|
||||
|
||||
if (serviceStackHandler != null)
|
||||
@ -446,7 +449,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
httpReq.OperationName = operationName = restHandler.RestPath.RequestType.Name;
|
||||
}
|
||||
serviceStackHandler.ProcessRequest(httpReq, httpRes, operationName);
|
||||
LogResponse(context, url, endPoint);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -529,7 +531,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||
{
|
||||
new ClientWebSocket();
|
||||
|
||||
_supportsNativeWebSocket = true;
|
||||
_supportsNativeWebSocket = false;
|
||||
}
|
||||
catch (PlatformNotSupportedException)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user