From 18325159c5b46d2aa31d2dafd837ede7214b28ef Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 10 Jun 2013 23:31:00 -0400 Subject: [PATCH] added a new MusicGenre entity --- MediaBrowser.Api/BaseApiService.cs | 5 + MediaBrowser.Api/Images/ImageService.cs | 20 +++ MediaBrowser.Api/MediaBrowser.Api.csproj | 1 + MediaBrowser.Api/UserLibrary/GenresService.cs | 9 +- .../UserLibrary/ItemByNameUserDataService.cs | 12 ++ .../UserLibrary/MusicGenresService.cs | 166 ++++++++++++++++++ .../Entities/Audio/MusicGenre.cs | 18 ++ .../IServerApplicationPaths.cs | 6 + .../Library/ILibraryManager.cs | 8 + .../MediaBrowser.Controller.csproj | 1 + .../Library/LibraryManager.cs | 11 ++ .../Library/LuceneSearchEngine.cs | 32 +++- .../ServerApplicationPaths.cs | 12 ++ MediaBrowser.WebDashboard/ApiClient.js | 153 ++++++++++++++++ MediaBrowser.WebDashboard/packages.config | 2 +- Nuget/MediaBrowser.Common.Internal.nuspec | 4 +- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +- 18 files changed, 450 insertions(+), 16 deletions(-) create mode 100644 MediaBrowser.Api/UserLibrary/MusicGenresService.cs create mode 100644 MediaBrowser.Controller/Entities/Audio/MusicGenre.cs diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index 36f8257b3..b2ab395db 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -110,6 +110,11 @@ namespace MediaBrowser.Api return libraryManager.GetGenre(DeSlugGenreName(name, libraryManager)); } + protected Task GetMusicGenre(string name, ILibraryManager libraryManager) + { + return libraryManager.GetMusicGenre(DeSlugGenreName(name, libraryManager)); + } + protected Task GetPerson(string name, ILibraryManager libraryManager) { return libraryManager.GetPerson(DeSlugPersonName(name, libraryManager)); diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 8656d75c0..56a1e1e17 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -167,6 +167,19 @@ namespace MediaBrowser.Api.Images public string Name { get; set; } } + [Route("/MusicGenres/{Name}/Images/{Type}", "GET")] + [Route("/MusicGenres/{Name}/Images/{Type}/{Index}", "GET")] + [Api(Description = "Gets a genre image")] + public class GetMusicGenreImage : ImageRequest + { + /// + /// Gets or sets the name. + /// + /// The name. + [ApiMember(Name = "Name", Description = "Genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Name { get; set; } + } + /// /// Class GetYearImage /// @@ -506,6 +519,13 @@ namespace MediaBrowser.Api.Images return GetImage(request, item); } + public object Get(GetMusicGenreImage request) + { + var item = GetMusicGenre(request.Name, _libraryManager).Result; + + return GetImage(request, item); + } + /// /// Posts the specified request. /// diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index e6352eb6f..13098b716 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -107,6 +107,7 @@ + diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs index 6dada4732..d44394c4f 100644 --- a/MediaBrowser.Api/UserLibrary/GenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GenresService.cs @@ -1,6 +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; @@ -170,13 +169,7 @@ namespace MediaBrowser.Api.UserLibrary SeriesCount = items.OfType().Count(), - GameCount = items.OfType().Count(), - - SongCount = items.OfType