mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-15 06:36:37 +00:00
support custom ordering of user views
This commit is contained in:
@@ -30,8 +30,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
{
|
||||
var artist = _libraryManager.GetArtist(name);
|
||||
|
||||
var genres = _libraryManager.RootFolder
|
||||
.RecursiveChildren
|
||||
var genres = user.RootFolder
|
||||
.GetRecursiveChildren(user)
|
||||
.OfType<Audio>()
|
||||
.Where(i => i.HasArtist(name))
|
||||
.SelectMany(i => i.Genres)
|
||||
|
||||
@@ -133,7 +133,19 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
return _libraryManager.Sort(list, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).Cast<Folder>();
|
||||
var sorted = _libraryManager.Sort(list, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList();
|
||||
|
||||
var orders = user.Configuration.OrderedViews.ToList();
|
||||
|
||||
return list
|
||||
.OrderBy(i =>
|
||||
{
|
||||
var index = orders.IndexOf(i.Id.ToString("N"));
|
||||
|
||||
return index == -1 ? int.MaxValue : index;
|
||||
})
|
||||
.ThenBy(sorted.IndexOf)
|
||||
.ThenBy(i => i.SortName);
|
||||
}
|
||||
|
||||
public Task<UserView> GetUserView(string type, User user, string sortName, CancellationToken cancellationToken)
|
||||
|
||||
@@ -1018,5 +1018,7 @@
|
||||
"LabelAllowLocalAccessWithoutPassword": "Allow local access without a password",
|
||||
"LabelAllowLocalAccessWithoutPasswordHelp": "When enabled, a password will not be required when signing in from within your home network.",
|
||||
"HeaderPassword": "Password",
|
||||
"HeaderLocalAccess": "Local Access"
|
||||
"HeaderLocalAccess": "Local Access",
|
||||
"HeaderViewOrder": "View Order",
|
||||
"LabelSelectUserViewOrder": "Choose the order your views will be displayed in within Media Browser apps"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user