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/PersonsService.cs | 72 +------------------------- 1 file changed, 1 insertion(+), 71 deletions(-) (limited to 'MediaBrowser.Api/UserLibrary/PersonsService.cs') diff --git a/MediaBrowser.Api/UserLibrary/PersonsService.cs b/MediaBrowser.Api/UserLibrary/PersonsService.cs index a21c53976..e8a6ddcc5 100644 --- a/MediaBrowser.Api/UserLibrary/PersonsService.cs +++ b/MediaBrowser.Api/UserLibrary/PersonsService.cs @@ -1,8 +1,5 @@ using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Dto; @@ -29,28 +26,6 @@ namespace MediaBrowser.Api.UserLibrary public string PersonTypes { get; set; } } - /// - /// Class GetPersonItemCounts - /// - [Route("/Persons/{Name}/Counts", "GET")] - [Api(Description = "Gets item counts of library items that a person appears in")] - public class GetPersonItemCounts : 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 Guid UserId { get; set; } - - /// - /// Gets or sets the name. - /// - /// The name. - [ApiMember(Name = "Name", Description = "The person name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public string Name { get; set; } - } - /// /// Class GetPerson /// @@ -136,43 +111,6 @@ namespace MediaBrowser.Api.UserLibrary return ToOptimizedResult(result); } - /// - /// Gets the specified request. - /// - /// The request. - /// System.Object. - public object Get(GetPersonItemCounts request) - { - var name = DeSlugPersonName(request.Name, LibraryManager); - - var items = GetItems(request.UserId).Where(i => i.People != null && i.People.Any(p => string.Equals(p.Name, name, StringComparison.OrdinalIgnoreCase))).ToList(); - - var counts = new ItemByNameCounts - { - TotalCount = items.Count, - - TrailerCount = items.OfType().Count(), - - MovieCount = items.OfType().Count(), - - SeriesCount = items.OfType().Count(), - - GameCount = items.OfType().Count(), - - SongCount = items.OfType