added studio and people placeholder pages

pull/702/head
Luke Pulverenti 12 years ago
parent e3f7dcac19
commit c3e3b68bb2

@ -68,7 +68,7 @@ namespace MediaBrowser.Api.UserLibrary
var ibnItemsArray = GetAllItems(request, items, user).ToArray();
IEnumerable<Tuple<string, Func<int>>> ibnItems = ibnItemsArray;
IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> ibnItems = ibnItemsArray;
var result = new ItemsResult
{
@ -132,7 +132,7 @@ namespace MediaBrowser.Api.UserLibrary
/// <param name="items">The items.</param>
/// <param name="user">The user.</param>
/// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
protected abstract IEnumerable<Tuple<string, Func<int>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user);
protected abstract IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user);
/// <summary>
/// Gets the entity.
@ -148,7 +148,7 @@ namespace MediaBrowser.Api.UserLibrary
/// <param name="user">The user.</param>
/// <param name="fields">The fields.</param>
/// <returns>Task{DtoBaseItem}.</returns>
private async Task<BaseItemDto> GetDto(Tuple<string, Func<int>> stub, User user, List<ItemFields> fields)
private async Task<BaseItemDto> GetDto(Tuple<string, Func<IEnumerable<BaseItem>>> stub, User user, List<ItemFields> 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;
}

@ -47,14 +47,14 @@ namespace MediaBrowser.Api.UserLibrary
/// <param name="items">The items.</param>
/// <param name="user">The user.</param>
/// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
protected override IEnumerable<Tuple<string, Func<int>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
protected override IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> 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<string, Func<int>>(name, () => itemsList.Count(i => i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase))));
.Select(name => new Tuple<string, Func<IEnumerable<BaseItem>>>(name, () => itemsList.Where(i => i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase))));
}
/// <summary>

@ -52,7 +52,7 @@ namespace MediaBrowser.Api.UserLibrary
/// <param name="items">The items.</param>
/// <param name="user">The user.</param>
/// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
protected override IEnumerable<Tuple<string, Func<int>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
protected override IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> 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<string, Func<int>>(name, () =>
.Select(name => new Tuple<string, Func<IEnumerable<BaseItem>>>(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)));
})
);
}

@ -47,14 +47,14 @@ namespace MediaBrowser.Api.UserLibrary
/// <param name="items">The items.</param>
/// <param name="user">The user.</param>
/// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
protected override IEnumerable<Tuple<string, Func<int>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
protected override IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> 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<string, Func<int>>(name, () => itemsList.Count(i => i.Studios.Contains(name, StringComparer.OrdinalIgnoreCase))));
.Select(name => new Tuple<string, Func<IEnumerable<BaseItem>>>(name, () => itemsList.Where(i => i.Studios.Contains(name, StringComparer.OrdinalIgnoreCase))));
}
/// <summary>

@ -53,14 +53,14 @@ namespace MediaBrowser.Api.UserLibrary
/// <param name="items">The items.</param>
/// <param name="user">The user.</param>
/// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
protected override IEnumerable<Tuple<string, Func<int>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
protected override IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items, User user)
{
var itemsList = items.Where(i => i.ProductionYear != null).ToList();
return itemsList
.Select(i => i.ProductionYear.Value)
.Distinct()
.Select(year => new Tuple<string, Func<int>>(year.ToString(UsCulture), () => itemsList.Count(i => i.ProductionYear.HasValue && i.ProductionYear.Value == year)));
.Select(year => new Tuple<string, Func<IEnumerable<BaseItem>>>(year.ToString(UsCulture), () => itemsList.Where(i => i.ProductionYear.HasValue && i.ProductionYear.Value == year)));
}
/// <summary>

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

@ -204,9 +204,15 @@
<Content Include="dashboard-ui\movies.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\moviepeople.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\moviesrecommended.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\moviestudios.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\musicrecommended.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -225,6 +231,12 @@
<Content Include="dashboard-ui\scripts\moviegenres.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\moviepeople.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\moviestudios.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\playlist.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -272,6 +284,9 @@
<Content Include="dashboard-ui\scripts\tvshows.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\tvstudios.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\videojsextensions.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -296,6 +311,9 @@
<Content Include="dashboard-ui\tvshows.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\tvstudios.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\userprofiles.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

Loading…
Cancel
Save