support custom ordering of user views

This commit is contained in:
Luke Pulverenti
2014-08-18 21:42:53 -04:00
parent 6a2f6782d3
commit b48d15296c
14 changed files with 195 additions and 78 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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"
}