mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 09:59:06 -07:00
Merge pull request #12457 from lostb1t/feature/boxset-sort
Add support for ItemSortBy values in BoxSet
This commit is contained in:
commit
549c01c736
@ -112,37 +112,31 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user)
|
||||
{
|
||||
if (!Enum.TryParse<ItemSortBy>(DisplayOrder, out var sortBy))
|
||||
{
|
||||
sortBy = ItemSortBy.PremiereDate;
|
||||
}
|
||||
|
||||
if (sortBy == ItemSortBy.Default)
|
||||
{
|
||||
return items;
|
||||
}
|
||||
|
||||
return LibraryManager.Sort(items, user, new[] { sortBy }, SortOrder.Ascending);
|
||||
}
|
||||
|
||||
public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
|
||||
{
|
||||
var children = base.GetChildren(user, includeLinkedChildren, query);
|
||||
|
||||
if (string.Equals(DisplayOrder, "SortName", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Sort by name
|
||||
return LibraryManager.Sort(children, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
||||
}
|
||||
|
||||
if (string.Equals(DisplayOrder, "PremiereDate", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Sort by release date
|
||||
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
||||
}
|
||||
|
||||
// Default sorting
|
||||
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
||||
return Sort(children, user).ToList();
|
||||
}
|
||||
|
||||
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
|
||||
{
|
||||
var children = base.GetRecursiveChildren(user, query);
|
||||
|
||||
if (string.Equals(DisplayOrder, "PremiereDate", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Sort by release date
|
||||
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
||||
}
|
||||
|
||||
return children;
|
||||
return Sort(children, user).ToList();
|
||||
}
|
||||
|
||||
public BoxSetInfo GetLookupInfo()
|
||||
|
Loading…
Reference in New Issue
Block a user