From 740a10a4e3f85ffcfd26ec18263d4c78d4b14ecc Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 10 Sep 2013 14:56:00 -0400 Subject: de-normalize item by name data. create counts during library scan for fast access. --- MediaBrowser.Api/UserLibrary/GameGenresService.cs | 42 +---------------------- 1 file changed, 1 insertion(+), 41 deletions(-) (limited to 'MediaBrowser.Api/UserLibrary/GameGenresService.cs') diff --git a/MediaBrowser.Api/UserLibrary/GameGenresService.cs b/MediaBrowser.Api/UserLibrary/GameGenresService.cs index 50ee09826..ff26fe423 100644 --- a/MediaBrowser.Api/UserLibrary/GameGenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GameGenresService.cs @@ -23,25 +23,6 @@ namespace MediaBrowser.Api.UserLibrary } } - [Route("/GameGenres/{Name}/Counts", "GET")] - [Api(Description = "Gets item counts of library items that a genre appears in")] - public class GetGameGenreItemCounts : IReturn - { - /// - /// Gets or sets the user id. - /// - /// The user id. - [ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } - - /// - /// Gets or sets the name. - /// - /// The name. - [ApiMember(Name = "Name", Description = "The genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public string Name { get; set; } - } - [Route("/GameGenres/{Name}", "GET")] [Api(Description = "Gets a Game genre, by name")] public class GetGameGenre : IReturn @@ -127,7 +108,7 @@ namespace MediaBrowser.Api.UserLibrary return itemsList .SelectMany(i => i.Genres) .Distinct(StringComparer.OrdinalIgnoreCase) - .Select(name => new IbnStub(name, () => itemsList.Where(i => i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase)), GetEntity)); + .Select(name => new IbnStub(name, GetEntity)); } /// @@ -139,26 +120,5 @@ namespace MediaBrowser.Api.UserLibrary { return LibraryManager.GetGameGenre(name); } - - /// - /// Gets the specified request. - /// - /// The request. - /// System.Object. - public object Get(GetGameGenreItemCounts request) - { - var name = DeSlugGameGenreName(request.Name, LibraryManager); - - var items = GetItems(request.UserId).Where(i => i.Genres != null && i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase)).ToList(); - - var counts = new ItemByNameCounts - { - TotalCount = items.Count, - - GameCount = items.OfType().Count() - }; - - return ToOptimizedResult(counts); - } } } -- cgit v1.2.3