diff --git a/MediaBrowser.Api/UserLibrary/UserViewsService.cs b/MediaBrowser.Api/UserLibrary/UserViewsService.cs index 715745a7d..89953c2bd 100644 --- a/MediaBrowser.Api/UserLibrary/UserViewsService.cs +++ b/MediaBrowser.Api/UserLibrary/UserViewsService.cs @@ -31,17 +31,6 @@ namespace MediaBrowser.Api.UserLibrary public string PresetViews { get; set; } } - [Route("/Users/{UserId}/SpecialViewOptions", "GET")] - public class GetSpecialViewOptions : IReturn> - { - /// - /// Gets or sets the user id. - /// - /// The user id. - [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public string UserId { get; set; } - } - [Route("/Users/{UserId}/GroupingOptions", "GET")] public class GetGroupingOptions : IReturn> { @@ -114,29 +103,6 @@ namespace MediaBrowser.Api.UserLibrary return ToOptimizedResult(result); } - public async Task Get(GetSpecialViewOptions request) - { - var user = _userManager.GetUserById(request.UserId); - - var views = user.RootFolder - .GetChildren(user, true) - .OfType() - .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 Get(GetGroupingOptions request) { var user = _userManager.GetUserById(request.UserId); @@ -159,11 +125,6 @@ namespace MediaBrowser.Api.UserLibrary return ToOptimizedResult(list); } - - private bool IsEligibleForSpecialView(ICollectionFolder view) - { - return UserView.IsEligibleForEnhancedView(view.CollectionType); - } } class SpecialViewOption diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index e89dd58c8..268fefbd3 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -761,22 +761,33 @@ namespace MediaBrowser.Controller.Entities itemsList = itemsList.Where(i => i.IsVisibleStandalone(query.User)); } - var itemsArray = itemsList.ToArray(); - var totalCount = itemsArray.Length; + IEnumerable returnItems; + int totalCount = 0; + + if (query.EnableTotalRecordCount) + { + var itemsArray = itemsList.ToArray(); + totalCount = itemsArray.Length; + returnItems = itemsArray; + } + else + { + returnItems = itemsList; + } if (limit.HasValue) { - itemsArray = itemsArray.Skip(startIndex ?? 0).Take(limit.Value).ToArray(); + returnItems = returnItems.Skip(startIndex ?? 0).Take(limit.Value); } else if (startIndex.HasValue) { - itemsArray = itemsArray.Skip(startIndex.Value).ToArray(); + returnItems = returnItems.Skip(startIndex.Value); } return new QueryResult { TotalRecordCount = totalCount, - Items = itemsArray + Items = returnItems.ToArray() }; } @@ -1493,7 +1504,7 @@ namespace MediaBrowser.Controller.Entities { if (itemDto.RecursiveItemCount.Value > 0) { - var unplayedPercentage = (unplayedCount/itemDto.RecursiveItemCount.Value)*100; + var unplayedPercentage = (unplayedCount / itemDto.RecursiveItemCount.Value) * 100; dto.PlayedPercentage = 100 - unplayedPercentage; dto.Played = dto.PlayedPercentage.Value >= 100; } diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs index fb00937fb..99601b290 100644 --- a/MediaBrowser.Controller/Entities/UserView.cs +++ b/MediaBrowser.Controller/Entities/UserView.cs @@ -153,17 +153,6 @@ namespace MediaBrowser.Controller.Entities 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) { var types = new[]