mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
update season methods
This commit is contained in:
parent
43c94884e7
commit
d6dc6ffe7e
5 changed files with 24 additions and 17 deletions
|
@ -702,7 +702,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
items = GetRecursiveChildren(user, query);
|
items = GetRecursiveChildren(user, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PostFilterAndSort(items, query);
|
return PostFilterAndSort(items, query, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(this is UserRootFolder) && !(this is AggregateFolder))
|
if (!(this is UserRootFolder) && !(this is AggregateFolder))
|
||||||
|
@ -903,7 +903,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
if (query.ItemIds.Length > 0)
|
if (query.ItemIds.Length > 0)
|
||||||
{
|
{
|
||||||
var specificItems = query.ItemIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList();
|
var specificItems = query.ItemIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList();
|
||||||
return Task.FromResult(PostFilterAndSort(specificItems, query));
|
return Task.FromResult(PostFilterAndSort(specificItems, query, true, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetItemsInternal(query);
|
return GetItemsInternal(query);
|
||||||
|
@ -959,12 +959,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
: GetChildren(user, true).Where(filter);
|
: GetChildren(user, true).Where(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PostFilterAndSort(items, query);
|
return PostFilterAndSort(items, query, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items, InternalItemsQuery query)
|
protected QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items, InternalItemsQuery query, bool collapseBoxSetItems, bool enableSorting)
|
||||||
{
|
{
|
||||||
return UserViewBuilder.PostFilterAndSort(items, this, null, query, LibraryManager, ConfigurationManager);
|
return UserViewBuilder.PostFilterAndSort(items, this, null, query, LibraryManager, ConfigurationManager, collapseBoxSetItems, enableSorting);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
|
public virtual IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
|
||||||
|
|
|
@ -176,7 +176,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
var items = GetEpisodes(user).Where(filter);
|
var items = GetEpisodes(user).Where(filter);
|
||||||
|
|
||||||
Logger.Debug("Season.GetItemsInternal entering PostFilterAndSort. Request id: " + id);
|
Logger.Debug("Season.GetItemsInternal entering PostFilterAndSort. Request id: " + id);
|
||||||
var result = PostFilterAndSort(items, query);
|
var result = PostFilterAndSort(items, query, false, false);
|
||||||
|
|
||||||
Logger.Debug("Season.GetItemsInternal complete. Request id: " + id);
|
Logger.Debug("Season.GetItemsInternal complete. Request id: " + id);
|
||||||
return Task.FromResult(result);
|
return Task.FromResult(result);
|
||||||
|
|
|
@ -237,7 +237,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
|
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
|
||||||
|
|
||||||
var items = GetSeasons(user).Where(filter);
|
var items = GetSeasons(user).Where(filter);
|
||||||
var result = PostFilterAndSort(items, query);
|
var result = PostFilterAndSort(items, query, false, true);
|
||||||
return Task.FromResult(result);
|
return Task.FromResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
var user = query.User;
|
var user = query.User;
|
||||||
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
|
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
|
||||||
|
|
||||||
return PostFilterAndSort(result.Where(filter), query);
|
return PostFilterAndSort(result.Where(filter), query, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetChildCount(User user)
|
public override int GetChildCount(User user)
|
||||||
|
|
|
@ -424,7 +424,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
query.SortBy = new string[] { };
|
query.SortBy = new string[] { };
|
||||||
|
|
||||||
return PostFilterAndSort(items, parent, null, query);
|
return PostFilterAndSort(items, parent, null, query, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetFavoriteSongs(Folder parent, User user, InternalItemsQuery query)
|
private QueryResult<BaseItem> GetFavoriteSongs(Folder parent, User user, InternalItemsQuery query)
|
||||||
|
@ -780,7 +780,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
items = items.Where(i => Filter(i, query.User, query, _userDataManager, _libraryManager));
|
items = items.Where(i => Filter(i, query.User, query, _userDataManager, _libraryManager));
|
||||||
|
|
||||||
return PostFilterAndSort(items, queryParent, null, query, _libraryManager, _config);
|
return PostFilterAndSort(items, queryParent, null, query, _libraryManager, _config, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool FilterItem(BaseItem item, InternalItemsQuery query)
|
public static bool FilterItem(BaseItem item, InternalItemsQuery query)
|
||||||
|
@ -791,9 +791,11 @@ namespace MediaBrowser.Controller.Entities
|
||||||
private QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items,
|
private QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items,
|
||||||
BaseItem queryParent,
|
BaseItem queryParent,
|
||||||
int? totalRecordLimit,
|
int? totalRecordLimit,
|
||||||
InternalItemsQuery query)
|
InternalItemsQuery query,
|
||||||
|
bool collapseBoxSetItems,
|
||||||
|
bool enableSorting)
|
||||||
{
|
{
|
||||||
return PostFilterAndSort(items, queryParent, totalRecordLimit, query, _libraryManager, _config);
|
return PostFilterAndSort(items, queryParent, totalRecordLimit, query, _libraryManager, _config, collapseBoxSetItems, enableSorting);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items,
|
public static QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items,
|
||||||
|
@ -801,7 +803,9 @@ namespace MediaBrowser.Controller.Entities
|
||||||
int? totalRecordLimit,
|
int? totalRecordLimit,
|
||||||
InternalItemsQuery query,
|
InternalItemsQuery query,
|
||||||
ILibraryManager libraryManager,
|
ILibraryManager libraryManager,
|
||||||
IServerConfigurationManager configurationManager)
|
IServerConfigurationManager configurationManager,
|
||||||
|
bool collapseBoxSetItems,
|
||||||
|
bool enableSorting)
|
||||||
{
|
{
|
||||||
var user = query.User;
|
var user = query.User;
|
||||||
|
|
||||||
|
@ -810,7 +814,10 @@ namespace MediaBrowser.Controller.Entities
|
||||||
query.IsVirtualUnaired,
|
query.IsVirtualUnaired,
|
||||||
query.IsUnaired);
|
query.IsUnaired);
|
||||||
|
|
||||||
|
if (collapseBoxSetItems)
|
||||||
|
{
|
||||||
items = CollapseBoxSetItemsIfNeeded(items, query, queryParent, user, configurationManager);
|
items = CollapseBoxSetItemsIfNeeded(items, query, queryParent, user, configurationManager);
|
||||||
|
}
|
||||||
|
|
||||||
// This must be the last filter
|
// This must be the last filter
|
||||||
if (!string.IsNullOrEmpty(query.AdjacentTo))
|
if (!string.IsNullOrEmpty(query.AdjacentTo))
|
||||||
|
@ -818,7 +825,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
items = FilterForAdjacency(items, query.AdjacentTo);
|
items = FilterForAdjacency(items, query.AdjacentTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Sort(items, totalRecordLimit, query, libraryManager);
|
return SortAndPage(items, totalRecordLimit, query, libraryManager, enableSorting);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<BaseItem> CollapseBoxSetItemsIfNeeded(IEnumerable<BaseItem> items,
|
public static IEnumerable<BaseItem> CollapseBoxSetItemsIfNeeded(IEnumerable<BaseItem> items,
|
||||||
|
@ -1191,10 +1198,10 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static QueryResult<BaseItem> Sort(IEnumerable<BaseItem> items,
|
public static QueryResult<BaseItem> SortAndPage(IEnumerable<BaseItem> items,
|
||||||
int? totalRecordLimit,
|
int? totalRecordLimit,
|
||||||
InternalItemsQuery query,
|
InternalItemsQuery query,
|
||||||
ILibraryManager libraryManager)
|
ILibraryManager libraryManager, bool enableSorting)
|
||||||
{
|
{
|
||||||
var user = query.User;
|
var user = query.User;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue