fix dlna latest lists

This commit is contained in:
Luke Pulverenti 2016-06-30 10:50:08 -04:00
parent d24fe143f6
commit b445948ebf
3 changed files with 28 additions and 10 deletions

View File

@ -128,11 +128,6 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
private void AddIpv4Option(HttpWebRequest request, HttpRequestOptions options)
{
if (!options.PreferIpv4)
{
return;
}
request.ServicePoint.BindIPEndPointDelegate = (servicePount, remoteEndPoint, retryCount) =>
{
if (remoteEndPoint.AddressFamily == AddressFamily.InterNetwork)
@ -150,7 +145,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
if (httpWebRequest != null)
{
AddIpv4Option(httpWebRequest, options);
if (options.PreferIpv4)
{
AddIpv4Option(httpWebRequest, options);
}
AddRequestHeaders(httpWebRequest, options);

View File

@ -550,7 +550,7 @@ namespace MediaBrowser.Controller.Entities
query.Limit = GetSpecialItemsLimit();
query.IncludeItemTypes = new[] { typeof(Movie).Name };
return _libraryManager.GetItemsResult(query);
return ConvertToResult(_libraryManager.GetItemList(query));
}
private QueryResult<BaseItem> GetMovieResume(Folder parent, User user, InternalItemsQuery query)
@ -564,7 +564,17 @@ namespace MediaBrowser.Controller.Entities
query.Limit = GetSpecialItemsLimit();
query.IncludeItemTypes = new[] { typeof(Movie).Name };
return _libraryManager.GetItemsResult(query);
return ConvertToResult(_libraryManager.GetItemList(query));
}
private QueryResult<BaseItem> ConvertToResult(IEnumerable<BaseItem> items)
{
var arr = items.ToArray();
return new QueryResult<BaseItem>
{
Items = arr,
TotalRecordCount = arr.Length
};
}
private async Task<QueryResult<BaseItem>> GetMovieGenres(Folder parent, User user, InternalItemsQuery query)
@ -667,7 +677,7 @@ namespace MediaBrowser.Controller.Entities
query.IncludeItemTypes = new[] { typeof(Episode).Name };
query.ExcludeLocationTypes = new[] { LocationType.Virtual };
return _libraryManager.GetItemsResult(query);
return ConvertToResult(_libraryManager.GetItemList(query));
}
private QueryResult<BaseItem> GetTvNextUp(Folder parent, InternalItemsQuery query)
@ -696,7 +706,7 @@ namespace MediaBrowser.Controller.Entities
query.Limit = GetSpecialItemsLimit();
query.IncludeItemTypes = new[] { typeof(Episode).Name };
return _libraryManager.GetItemsResult(query);
return ConvertToResult(_libraryManager.GetItemList(query));
}
private QueryResult<BaseItem> GetTvSeries(Folder parent, User user, InternalItemsQuery query)

View File

@ -1277,6 +1277,16 @@ namespace MediaBrowser.Server.Implementations.Library
public IEnumerable<BaseItem> GetItemList(InternalItemsQuery query)
{
if (query.Recursive && query.ParentId.HasValue)
{
var parent = GetItemById(query.ParentId.Value);
if (parent != null)
{
SetTopParentIdsOrAncestors(query, new List<BaseItem> { parent });
query.ParentId = null;
}
}
if (query.User != null)
{
AddUserToQuery(query, query.User);