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/StudiosService.cs | 59 +------------------------- 1 file changed, 1 insertion(+), 58 deletions(-) (limited to 'MediaBrowser.Api/UserLibrary/StudiosService.cs') diff --git a/MediaBrowser.Api/UserLibrary/StudiosService.cs b/MediaBrowser.Api/UserLibrary/StudiosService.cs index f58adb1fa..5f42eab80 100644 --- a/MediaBrowser.Api/UserLibrary/StudiosService.cs +++ b/MediaBrowser.Api/UserLibrary/StudiosService.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; @@ -24,25 +21,6 @@ namespace MediaBrowser.Api.UserLibrary { } - [Route("/Studios/{Name}/Counts", "GET")] - [Api(Description = "Gets item counts of library items that a studio appears in")] - public class GetStudioItemCounts : 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 studio name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public string Name { get; set; } - } - /// /// Class GetStudio /// @@ -109,41 +87,6 @@ namespace MediaBrowser.Api.UserLibrary return await DtoService.GetBaseItemDto(item, fields.ToList()).ConfigureAwait(false); } - /// - /// Gets the specified request. - /// - /// The request. - /// System.Object. - public object Get(GetStudioItemCounts request) - { - var name = DeSlugStudioName(request.Name, LibraryManager); - - var items = GetItems(request.UserId).Where(i => i.Studios != null && i.Studios.Contains(name, StringComparer.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