mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-20 07:45:26 +03:00
update client sync
This commit is contained in:
@@ -39,6 +39,17 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
public string UserId { get; set; }
|
||||
}
|
||||
|
||||
[Route("/Users/{UserId}/GroupingOptions", "GET")]
|
||||
public class GetGroupingOptions : IReturn<List<SpecialViewOption>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the user id.
|
||||
/// </summary>
|
||||
/// <value>The user id.</value>
|
||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||
public string UserId { get; set; }
|
||||
}
|
||||
|
||||
public class UserViewsService : BaseApiService
|
||||
{
|
||||
private readonly IUserManager _userManager;
|
||||
@@ -105,6 +116,29 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
return ToOptimizedResult(list);
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetGroupingOptions request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.UserId);
|
||||
|
||||
var views = user.RootFolder
|
||||
.GetChildren(user, true)
|
||||
.OfType<Folder>()
|
||||
.Where(i => !UserView.IsExcludedFromGrouping(i))
|
||||
.ToList();
|
||||
|
||||
var list = views
|
||||
.Select(i => new SpecialViewOption
|
||||
{
|
||||
Name = i.Name,
|
||||
Id = i.Id.ToString("N")
|
||||
|
||||
})
|
||||
.OrderBy(i => i.Name)
|
||||
.ToList();
|
||||
|
||||
return ToOptimizedResult(list);
|
||||
}
|
||||
|
||||
private bool IsEligibleForSpecialView(ICollectionFolder view)
|
||||
{
|
||||
var types = new[] { CollectionType.Movies, CollectionType.TvShows, CollectionType.Games, CollectionType.Music, CollectionType.Photos };
|
||||
|
||||
Reference in New Issue
Block a user