|
@@ -112,37 +112,31 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren, InternalItemsQuery query)
|
|
|
+ private IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user)
|
|
|
{
|
|
|
- var children = base.GetChildren(user, includeLinkedChildren, query);
|
|
|
-
|
|
|
- if (string.Equals(DisplayOrder, "SortName", StringComparison.OrdinalIgnoreCase))
|
|
|
+ if (!Enum.TryParse<ItemSortBy>(DisplayOrder, out var sortBy))
|
|
|
{
|
|
|
- // Sort by name
|
|
|
- return LibraryManager.Sort(children, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
|
|
+ sortBy = ItemSortBy.PremiereDate;
|
|
|
}
|
|
|
|
|
|
- if (string.Equals(DisplayOrder, "PremiereDate", StringComparison.OrdinalIgnoreCase))
|
|
|
+ if (sortBy == ItemSortBy.Default)
|
|
|
{
|
|
|
- // Sort by release date
|
|
|
- return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
|
|
+ return items;
|
|
|
}
|
|
|
|
|
|
- // Default sorting
|
|
|
- return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
|
|
+ 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);
|
|
|
+ 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()
|