From c3e3b68bb2e290d543c334716ca3a1127e54b484 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 11 Apr 2013 18:09:08 -0400 Subject: [PATCH] added studio and people placeholder pages --- .../UserLibrary/BaseItemsByNameService.cs | 14 ++++++++++---- MediaBrowser.Api/UserLibrary/GenresService.cs | 4 ++-- MediaBrowser.Api/UserLibrary/PersonsService.cs | 8 ++++---- MediaBrowser.Api/UserLibrary/StudiosService.cs | 4 ++-- MediaBrowser.Api/UserLibrary/YearsService.cs | 4 ++-- .../Api/DashboardService.cs | 3 +++ .../MediaBrowser.WebDashboard.csproj | 18 ++++++++++++++++++ 7 files changed, 41 insertions(+), 14 deletions(-) diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs index f96a4baa7..ae1e0a3f8 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs @@ -68,7 +68,7 @@ namespace MediaBrowser.Api.UserLibrary var ibnItemsArray = GetAllItems(request, items, user).ToArray(); - IEnumerable>> ibnItems = ibnItemsArray; + IEnumerable>>> ibnItems = ibnItemsArray; var result = new ItemsResult { @@ -132,7 +132,7 @@ namespace MediaBrowser.Api.UserLibrary /// The items. /// The user. /// IEnumerable{Tuple{System.StringFunc{System.Int32}}}. - protected abstract IEnumerable>> GetAllItems(GetItemsByName request, IEnumerable items, User user); + protected abstract IEnumerable>>> GetAllItems(GetItemsByName request, IEnumerable items, User user); /// /// Gets the entity. @@ -148,7 +148,7 @@ namespace MediaBrowser.Api.UserLibrary /// The user. /// The fields. /// Task{DtoBaseItem}. - private async Task GetDto(Tuple> stub, User user, List fields) + private async Task GetDto(Tuple>> stub, User user, List fields) { BaseItem item; @@ -164,7 +164,13 @@ namespace MediaBrowser.Api.UserLibrary var dto = await new DtoBuilder(Logger, LibraryManager, UserManager).GetBaseItemDto(item, user, fields).ConfigureAwait(false); - dto.ChildCount = stub.Item2(); + if (fields.Contains(ItemFields.ItemCounts)) + { + var items = stub.Item2().ToList(); + + dto.ChildCount = items.Count; + dto.RecentlyAddedItemCount = items.Count(i => i.IsRecentlyAdded(user)); + } return dto; } diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs index 5957c7ce6..13c441c63 100644 --- a/MediaBrowser.Api/UserLibrary/GenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GenresService.cs @@ -47,14 +47,14 @@ namespace MediaBrowser.Api.UserLibrary /// The items. /// The user. /// IEnumerable{Tuple{System.StringFunc{System.Int32}}}. - protected override IEnumerable>> GetAllItems(GetItemsByName request, IEnumerable items, User user) + protected override IEnumerable>>> GetAllItems(GetItemsByName request, IEnumerable items, User user) { var itemsList = items.Where(i => i.Genres != null).ToList(); return itemsList .SelectMany(i => i.Genres) .Distinct(StringComparer.OrdinalIgnoreCase) - .Select(name => new Tuple>(name, () => itemsList.Count(i => i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase)))); + .Select(name => new Tuple>>(name, () => itemsList.Where(i => i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase)))); } /// diff --git a/MediaBrowser.Api/UserLibrary/PersonsService.cs b/MediaBrowser.Api/UserLibrary/PersonsService.cs index 822feee15..020c373a0 100644 --- a/MediaBrowser.Api/UserLibrary/PersonsService.cs +++ b/MediaBrowser.Api/UserLibrary/PersonsService.cs @@ -52,7 +52,7 @@ namespace MediaBrowser.Api.UserLibrary /// The items. /// The user. /// IEnumerable{Tuple{System.StringFunc{System.Int32}}}. - protected override IEnumerable>> GetAllItems(GetItemsByName request, IEnumerable items, User user) + protected override IEnumerable>>> GetAllItems(GetItemsByName request, IEnumerable items, User user) { var inputPersonTypes = ((GetPersons) request).PersonTypes; var personTypes = string.IsNullOrEmpty(inputPersonTypes) ? new string[] { } : inputPersonTypes.Split(','); @@ -66,14 +66,14 @@ namespace MediaBrowser.Api.UserLibrary .Select(i => i.Name) .Distinct(StringComparer.OrdinalIgnoreCase) - .Select(name => new Tuple>(name, () => + .Select(name => new Tuple>>(name, () => { if (personTypes.Length == 0) { - return itemsList.Count(i => i.People.Any(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase))); + return itemsList.Where(i => i.People.Any(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase))); } - return itemsList.Count(i => i.People.Any(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && personTypes.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase))); + return itemsList.Where(i => i.People.Any(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && personTypes.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase))); }) ); } diff --git a/MediaBrowser.Api/UserLibrary/StudiosService.cs b/MediaBrowser.Api/UserLibrary/StudiosService.cs index 884026670..219475704 100644 --- a/MediaBrowser.Api/UserLibrary/StudiosService.cs +++ b/MediaBrowser.Api/UserLibrary/StudiosService.cs @@ -47,14 +47,14 @@ namespace MediaBrowser.Api.UserLibrary /// The items. /// The user. /// IEnumerable{Tuple{System.StringFunc{System.Int32}}}. - protected override IEnumerable>> GetAllItems(GetItemsByName request, IEnumerable items, User user) + protected override IEnumerable>>> GetAllItems(GetItemsByName request, IEnumerable items, User user) { var itemsList = items.Where(i => i.Studios != null).ToList(); return itemsList .SelectMany(i => i.Studios) .Distinct(StringComparer.OrdinalIgnoreCase) - .Select(name => new Tuple>(name, () => itemsList.Count(i => i.Studios.Contains(name, StringComparer.OrdinalIgnoreCase)))); + .Select(name => new Tuple>>(name, () => itemsList.Where(i => i.Studios.Contains(name, StringComparer.OrdinalIgnoreCase)))); } /// diff --git a/MediaBrowser.Api/UserLibrary/YearsService.cs b/MediaBrowser.Api/UserLibrary/YearsService.cs index 2b1b2e652..f2cf36750 100644 --- a/MediaBrowser.Api/UserLibrary/YearsService.cs +++ b/MediaBrowser.Api/UserLibrary/YearsService.cs @@ -53,14 +53,14 @@ namespace MediaBrowser.Api.UserLibrary /// The items. /// The user. /// IEnumerable{Tuple{System.StringFunc{System.Int32}}}. - protected override IEnumerable>> GetAllItems(GetItemsByName request, IEnumerable items, User user) + protected override IEnumerable>>> GetAllItems(GetItemsByName request, IEnumerable items, User user) { var itemsList = items.Where(i => i.ProductionYear != null).ToList(); return itemsList .Select(i => i.ProductionYear.Value) .Distinct() - .Select(year => new Tuple>(year.ToString(UsCulture), () => itemsList.Count(i => i.ProductionYear.HasValue && i.ProductionYear.Value == year))); + .Select(year => new Tuple>>(year.ToString(UsCulture), () => itemsList.Where(i => i.ProductionYear.HasValue && i.ProductionYear.Value == year))); } /// diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 4fafdab7c..e6bb0a257 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -463,7 +463,9 @@ namespace MediaBrowser.WebDashboard.Api "metadataimagespage.js", "moviegenres.js", "movies.js", + "moviepeople.js", "moviesrecommended.js", + "moviestudios.js", "playlist.js", "pluginspage.js", "pluginupdatespage.js", @@ -475,6 +477,7 @@ namespace MediaBrowser.WebDashboard.Api "tvseries.js", "tvrecommended.js", "tvshows.js", + "tvstudios.js", "updatepasswordpage.js", "userimagepage.js", "userprofilespage.js", diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 22d40f9b6..3ae33b65d 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -204,9 +204,15 @@ PreserveNewest + + PreserveNewest + PreserveNewest + + PreserveNewest + PreserveNewest @@ -225,6 +231,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -272,6 +284,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest @@ -296,6 +311,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest