add landing screen settings
This commit is contained in:
parent
310f0e2811
commit
7147bec7d8
|
@ -31,17 +31,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
public string PresetViews { get; set; }
|
public string PresetViews { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Users/{UserId}/SpecialViewOptions", "GET")]
|
|
||||||
public class GetSpecialViewOptions : 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; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[Route("/Users/{UserId}/GroupingOptions", "GET")]
|
[Route("/Users/{UserId}/GroupingOptions", "GET")]
|
||||||
public class GetGroupingOptions : IReturn<List<SpecialViewOption>>
|
public class GetGroupingOptions : IReturn<List<SpecialViewOption>>
|
||||||
{
|
{
|
||||||
|
@ -114,29 +103,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<object> Get(GetSpecialViewOptions request)
|
|
||||||
{
|
|
||||||
var user = _userManager.GetUserById(request.UserId);
|
|
||||||
|
|
||||||
var views = user.RootFolder
|
|
||||||
.GetChildren(user, true)
|
|
||||||
.OfType<ICollectionFolder>()
|
|
||||||
.Where(IsEligibleForSpecialView)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var list = views
|
|
||||||
.Select(i => new SpecialViewOption
|
|
||||||
{
|
|
||||||
Name = i.Name,
|
|
||||||
Id = i.Id.ToString("N")
|
|
||||||
|
|
||||||
})
|
|
||||||
.OrderBy(i => i.Name)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return ToOptimizedResult(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<object> Get(GetGroupingOptions request)
|
public async Task<object> Get(GetGroupingOptions request)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(request.UserId);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
@ -159,11 +125,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
return ToOptimizedResult(list);
|
return ToOptimizedResult(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsEligibleForSpecialView(ICollectionFolder view)
|
|
||||||
{
|
|
||||||
return UserView.IsEligibleForEnhancedView(view.CollectionType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpecialViewOption
|
class SpecialViewOption
|
||||||
|
|
|
@ -761,22 +761,33 @@ namespace MediaBrowser.Controller.Entities
|
||||||
itemsList = itemsList.Where(i => i.IsVisibleStandalone(query.User));
|
itemsList = itemsList.Where(i => i.IsVisibleStandalone(query.User));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IEnumerable<BaseItem> returnItems;
|
||||||
|
int totalCount = 0;
|
||||||
|
|
||||||
|
if (query.EnableTotalRecordCount)
|
||||||
|
{
|
||||||
var itemsArray = itemsList.ToArray();
|
var itemsArray = itemsList.ToArray();
|
||||||
var totalCount = itemsArray.Length;
|
totalCount = itemsArray.Length;
|
||||||
|
returnItems = itemsArray;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnItems = itemsList;
|
||||||
|
}
|
||||||
|
|
||||||
if (limit.HasValue)
|
if (limit.HasValue)
|
||||||
{
|
{
|
||||||
itemsArray = itemsArray.Skip(startIndex ?? 0).Take(limit.Value).ToArray();
|
returnItems = returnItems.Skip(startIndex ?? 0).Take(limit.Value);
|
||||||
}
|
}
|
||||||
else if (startIndex.HasValue)
|
else if (startIndex.HasValue)
|
||||||
{
|
{
|
||||||
itemsArray = itemsArray.Skip(startIndex.Value).ToArray();
|
returnItems = returnItems.Skip(startIndex.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new QueryResult<BaseItem>
|
return new QueryResult<BaseItem>
|
||||||
{
|
{
|
||||||
TotalRecordCount = totalCount,
|
TotalRecordCount = totalCount,
|
||||||
Items = itemsArray
|
Items = returnItems.ToArray()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1493,7 +1504,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
if (itemDto.RecursiveItemCount.Value > 0)
|
if (itemDto.RecursiveItemCount.Value > 0)
|
||||||
{
|
{
|
||||||
var unplayedPercentage = (unplayedCount/itemDto.RecursiveItemCount.Value)*100;
|
var unplayedPercentage = (unplayedCount / itemDto.RecursiveItemCount.Value) * 100;
|
||||||
dto.PlayedPercentage = 100 - unplayedPercentage;
|
dto.PlayedPercentage = 100 - unplayedPercentage;
|
||||||
dto.Played = dto.PlayedPercentage.Value >= 100;
|
dto.Played = dto.PlayedPercentage.Value >= 100;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,17 +153,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return types.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
return types.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsEligibleForEnhancedView(string viewType)
|
|
||||||
{
|
|
||||||
var types = new[]
|
|
||||||
{
|
|
||||||
CollectionType.Movies,
|
|
||||||
CollectionType.TvShows
|
|
||||||
};
|
|
||||||
|
|
||||||
return types.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool EnableOriginalFolder(string viewType)
|
public static bool EnableOriginalFolder(string viewType)
|
||||||
{
|
{
|
||||||
var types = new[]
|
var types = new[]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user