diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-06-10 23:31:00 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-06-10 23:31:00 -0400 |
| commit | 18325159c5b46d2aa31d2dafd837ede7214b28ef (patch) | |
| tree | 4966247933da5aeffad1672d87c67c1ebbb036f1 | |
| parent | fab983b6dcf7b282e8c96e3509209fcc568fb922 (diff) | |
added a new MusicGenre entity
18 files changed, 450 insertions, 16 deletions
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<MusicGenre> GetMusicGenre(string name, ILibraryManager libraryManager) + { + return libraryManager.GetMusicGenre(DeSlugGenreName(name, libraryManager)); + } + protected Task<Person> 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 + { + /// <summary> + /// Gets or sets the name. + /// </summary> + /// <value>The name.</value> + [ApiMember(Name = "Name", Description = "Genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Name { get; set; } + } + /// <summary> /// Class GetYearImage /// </summary> @@ -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); + } + /// <summary> /// Posts the specified request. /// </summary> 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 @@ <Compile Include="UserLibrary\GenresService.cs" /> <Compile Include="UserLibrary\ItemByNameUserDataService.cs" /> <Compile Include="UserLibrary\ItemsService.cs" /> + <Compile Include="UserLibrary\MusicGenresService.cs" /> <Compile Include="UserLibrary\PersonsService.cs" /> <Compile Include="UserLibrary\StudiosService.cs" /> <Compile Include="UserLibrary\UserLibraryService.cs" /> 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<Series>().Count(), - GameCount = items.OfType<BaseGame>().Count(), - - SongCount = items.OfType<Audio>().Count(), - - AlbumCount = items.OfType<MusicAlbum>().Count(), - - MusicVideoCount = items.OfType<MusicVideo>().Count() + GameCount = items.OfType<BaseGame>().Count() }; return ToOptimizedResult(counts); diff --git a/MediaBrowser.Api/UserLibrary/ItemByNameUserDataService.cs b/MediaBrowser.Api/UserLibrary/ItemByNameUserDataService.cs index 835db6a17..42b76e29d 100644 --- a/MediaBrowser.Api/UserLibrary/ItemByNameUserDataService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemByNameUserDataService.cs @@ -16,6 +16,7 @@ namespace MediaBrowser.Api.UserLibrary [Route("/Users/{UserId}/Favorites/Persons/{Name}", "POST")] [Route("/Users/{UserId}/Favorites/Studios/{Name}", "POST")] [Route("/Users/{UserId}/Favorites/Genres/{Name}", "POST")] + [Route("/Users/{UserId}/Favorites/MusicGenres/{Name}", "POST")] [Api(Description = "Marks something as a favorite")] public class MarkItemByNameFavorite : IReturnVoid { @@ -41,6 +42,7 @@ namespace MediaBrowser.Api.UserLibrary [Route("/Users/{UserId}/Favorites/Persons/{Name}", "DELETE")] [Route("/Users/{UserId}/Favorites/Studios/{Name}", "DELETE")] [Route("/Users/{UserId}/Favorites/Genres/{Name}", "DELETE")] + [Route("/Users/{UserId}/Favorites/MusicGenres/{Name}", "DELETE")] [Api(Description = "Unmarks something as a favorite")] public class UnmarkItemByNameFavorite : IReturnVoid { @@ -66,6 +68,7 @@ namespace MediaBrowser.Api.UserLibrary [Route("/Users/{UserId}/Ratings/Persons/{Name}", "POST")] [Route("/Users/{UserId}/Ratings/Studios/{Name}", "POST")] [Route("/Users/{UserId}/Ratings/Genres/{Name}", "POST")] + [Route("/Users/{UserId}/Ratings/MusicGenres/{Name}", "POST")] [Api(Description = "Updates a user's rating for an item")] public class UpdateItemByNameRating : IReturnVoid { @@ -98,6 +101,7 @@ namespace MediaBrowser.Api.UserLibrary [Route("/Users/{UserId}/Ratings/Persons/{Name}", "DELETE")] [Route("/Users/{UserId}/Ratings/Studios/{Name}", "DELETE")] [Route("/Users/{UserId}/Ratings/Genres/{Name}", "DELETE")] + [Route("/Users/{UserId}/Ratings/MusicGenres/{Name}", "DELETE")] [Api(Description = "Deletes a user's saved personal rating for an item")] public class DeleteItemByNameRating : IReturnVoid { @@ -222,6 +226,10 @@ namespace MediaBrowser.Api.UserLibrary { item = await GetGenre(name, LibraryManager).ConfigureAwait(false); } + else if (string.Equals(type, "MusicGenres")) + { + item = await GetMusicGenre(name, LibraryManager).ConfigureAwait(false); + } else if (string.Equals(type, "Studios")) { item = await GetStudio(name, LibraryManager).ConfigureAwait(false); @@ -266,6 +274,10 @@ namespace MediaBrowser.Api.UserLibrary { item = await GetGenre(name, LibraryManager).ConfigureAwait(false); } + else if (string.Equals(type, "MusicGenres")) + { + item = await GetMusicGenre(name, LibraryManager).ConfigureAwait(false); + } else if (string.Equals(type, "Studios")) { item = await GetStudio(name, LibraryManager).ConfigureAwait(false); diff --git a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs new file mode 100644 index 000000000..81d284915 --- /dev/null +++ b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs @@ -0,0 +1,166 @@ +using MediaBrowser.Controller.Dto; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Audio; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Persistence; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Querying; +using ServiceStack.ServiceHost; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MediaBrowser.Api.UserLibrary +{ + [Route("/MusicGenres", "GET")] + [Api(Description = "Gets all music genres from a given item, folder, or the entire library")] + public class GetMusicGenres : GetItemsByName + { + } + + [Route("/MusicGenres/{Name}/Counts", "GET")] + [Api(Description = "Gets item counts of library items that a genre appears in")] + public class GetMusicGenreItemCounts : IReturn<ItemByNameCounts> + { + /// <summary> + /// Gets or sets the user id. + /// </summary> + /// <value>The user id.</value> + [ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public Guid? UserId { get; set; } + + /// <summary> + /// Gets or sets the name. + /// </summary> + /// <value>The name.</value> + [ApiMember(Name = "Name", Description = "The genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Name { get; set; } + } + + [Route("/MusicGenres/{Name}", "GET")] + [Api(Description = "Gets a music genre, by name")] + public class GetMusicGenre : IReturn<BaseItemDto> + { + /// <summary> + /// Gets or sets the name. + /// </summary> + /// <value>The name.</value> + [ApiMember(Name = "Name", Description = "The genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Name { get; set; } + + /// <summary> + /// Gets or sets the user id. + /// </summary> + /// <value>The user id.</value> + [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public Guid? UserId { get; set; } + } + + public class MusicGenresService : BaseItemsByNameService<MusicGenre> + { + public MusicGenresService(IUserManager userManager, ILibraryManager libraryManager, IUserDataRepository userDataRepository) + : base(userManager, libraryManager, userDataRepository) + { + } + + /// <summary> + /// Gets the specified request. + /// </summary> + /// <param name="request">The request.</param> + /// <returns>System.Object.</returns> + public object Get(GetMusicGenre request) + { + var result = GetItem(request).Result; + + return ToOptimizedResult(result); + } + + /// <summary> + /// Gets the item. + /// </summary> + /// <param name="request">The request.</param> + /// <returns>Task{BaseItemDto}.</returns> + private async Task<BaseItemDto> GetItem(GetMusicGenre request) + { + var item = await GetMusicGenre(request.Name, LibraryManager).ConfigureAwait(false); + + // Get everything + var fields = Enum.GetNames(typeof(ItemFields)).Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)); + + var builder = new DtoBuilder(Logger, LibraryManager, UserDataRepository); + + if (request.UserId.HasValue) + { + var user = UserManager.GetUserById(request.UserId.Value); + + return await builder.GetBaseItemDto(item, fields.ToList(), user).ConfigureAwait(false); + } + + return await builder.GetBaseItemDto(item, fields.ToList()).ConfigureAwait(false); + } + + /// <summary> + /// Gets the specified request. + /// </summary> + /// <param name="request">The request.</param> + /// <returns>System.Object.</returns> + public object Get(GetMusicGenres request) + { + var result = GetResult(request).Result; + + return ToOptimizedResult(result); + } + + /// <summary> + /// Gets all items. + /// </summary> + /// <param name="request">The request.</param> + /// <param name="items">The items.</param> + /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns> + protected override IEnumerable<IbnStub<MusicGenre>> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items) + { + var itemsList = items.Where(i => i.Genres != null).ToList(); + + return itemsList + .SelectMany(i => i.Genres) + .Distinct(StringComparer.OrdinalIgnoreCase) + .Select(name => new IbnStub<MusicGenre>(name, () => itemsList.Where(i => i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase)), GetEntity)); + } + + /// <summary> + /// Gets the entity. + /// </summary> + /// <param name="name">The name.</param> + /// <returns>Task{Genre}.</returns> + protected Task<MusicGenre> GetEntity(string name) + { + return LibraryManager.GetMusicGenre(name); + } + + /// <summary> + /// Gets the specified request. + /// </summary> + /// <param name="request">The request.</param> + /// <returns>System.Object.</returns> + public object Get(GetMusicGenreItemCounts request) + { + var name = DeSlugGenreName(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, + + SongCount = items.OfType<Audio>().Count(), + + AlbumCount = items.OfType<MusicAlbum>().Count(), + + MusicVideoCount = items.OfType<MusicVideo>().Count() + }; + + return ToOptimizedResult(counts); + } + } +} diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs new file mode 100644 index 000000000..8d34cf7da --- /dev/null +++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs @@ -0,0 +1,18 @@ + +namespace MediaBrowser.Controller.Entities.Audio +{ + /// <summary> + /// Class MusicGenre + /// </summary> + public class MusicGenre : BaseItem + { + /// <summary> + /// Gets the user data key. + /// </summary> + /// <returns>System.String.</returns> + public override string GetUserDataKey() + { + return "MusicGenre-" + Name; + } + } +} diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs index 9325d2054..58b6bb12f 100644 --- a/MediaBrowser.Controller/IServerApplicationPaths.cs +++ b/MediaBrowser.Controller/IServerApplicationPaths.cs @@ -41,6 +41,12 @@ namespace MediaBrowser.Controller string GenrePath { get; } /// <summary> + /// Gets the music genre path. + /// </summary> + /// <value>The music genre path.</value> + string MusicGenrePath { get; } + + /// <summary> /// Gets the artists path. /// </summary> /// <value>The artists path.</value> diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index ff859af9c..dd2afcb3f 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -82,6 +82,14 @@ namespace MediaBrowser.Controller.Library Task<Genre> GetGenre(string name, bool allowSlowProviders = false); /// <summary> + /// Gets the genre. + /// </summary> + /// <param name="name">The name.</param> + /// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param> + /// <returns>Task{MusicGenre}.</returns> + Task<MusicGenre> GetMusicGenre(string name, bool allowSlowProviders = false); + + /// <summary> /// Gets a Year /// </summary> /// <param name="value">The value.</param> diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 96989f568..ba9e9f5bd 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -73,6 +73,7 @@ <Compile Include="Configuration\IServerConfigurationManager.cs" /> <Compile Include="Dto\SessionInfoDtoBuilder.cs" /> <Compile Include="Entities\Audio\MusicAlbumDisc.cs" /> + <Compile Include="Entities\Audio\MusicGenre.cs" /> <Compile Include="Entities\IByReferenceItem.cs" /> <Compile Include="Entities\MusicVideo.cs" /> <Compile Include="Library\ILibraryPostScanTask.cs" /> diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index ed4e1dcb3..fb05c8c43 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -635,6 +635,17 @@ namespace MediaBrowser.Server.Implementations.Library } /// <summary> + /// Gets the genre. + /// </summary> + /// <param name="name">The name.</param> + /// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param> + /// <returns>Task{MusicGenre}.</returns> + public Task<MusicGenre> GetMusicGenre(string name, bool allowSlowProviders = false) + { + return GetItemByName<MusicGenre>(ConfigurationManager.ApplicationPaths.MusicGenrePath, name, CancellationToken.None, allowSlowProviders); + } + + /// <summary> /// Gets a Genre /// </summary> /// <param name="name">The name.</param> diff --git a/MediaBrowser.Server.Implementations/Library/LuceneSearchEngine.cs b/MediaBrowser.Server.Implementations/Library/LuceneSearchEngine.cs index 891965f12..4a521658f 100644 --- a/MediaBrowser.Server.Implementations/Library/LuceneSearchEngine.cs +++ b/MediaBrowser.Server.Implementations/Library/LuceneSearchEngine.cs @@ -111,6 +111,7 @@ namespace MediaBrowser.Server.Implementations.Library var items = inputItems.Where(i => !(i is MusicArtist)).ToList(); + // Add search hints based on item name hints.AddRange(items.Select(item => { var index = GetIndex(item.Name, searchTerm, terms); @@ -144,8 +145,9 @@ namespace MediaBrowser.Server.Implementations.Library } } - // Find genres - var genres = items.SelectMany(i => i.Genres) + // Find genres, from non-audio items + var genres = items.Where(i => !(i is Audio) && !(i is MusicAlbum) && !(i is MusicAlbumDisc) && !(i is MusicArtist) && !(i is MusicVideo)) + .SelectMany(i => i.Genres) .Where(i => !string.IsNullOrEmpty(i)) .Distinct(StringComparer.OrdinalIgnoreCase) .ToList(); @@ -169,6 +171,32 @@ namespace MediaBrowser.Server.Implementations.Library } } + // Find music genres + var musicGenres = items.Where(i => (i is Audio) || (i is MusicAlbum) || (i is MusicAlbumDisc) || (i is MusicArtist) || (i is MusicVideo)) + .SelectMany(i => i.Genres) + .Where(i => !string.IsNullOrEmpty(i)) + .Distinct(StringComparer.OrdinalIgnoreCase) + .ToList(); + + foreach (var item in musicGenres) + { + var index = GetIndex(item, searchTerm, terms); + + if (index.Item2 != -1) + { + try + { + var genre = await _libraryManager.GetMusicGenre(item).ConfigureAwait(false); + + hints.Add(new Tuple<BaseItem, string, int>(genre, index.Item1, index.Item2)); + } + catch (Exception ex) + { + _logger.ErrorException("Error getting {0}", ex, item); + } + } + } + // Find studios var studios = items.SelectMany(i => i.Studios) .Where(i => !string.IsNullOrEmpty(i)) diff --git a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs index 655876c8c..c2512e016 100644 --- a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs +++ b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs @@ -107,6 +107,18 @@ namespace MediaBrowser.Server.Implementations } /// <summary> + /// Gets the path to the Genre directory + /// </summary> + /// <value>The genre path.</value> + public string MusicGenrePath + { + get + { + return Path.Combine(ItemsByNamePath, "MusicGenre"); + } + } + + /// <summary> /// Gets the path to the Studio directory /// </summary> /// <value>The studio path.</value> diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js index 572cb0cf2..39c154b4b 100644 --- a/MediaBrowser.WebDashboard/ApiClient.js +++ b/MediaBrowser.WebDashboard/ApiClient.js @@ -1152,6 +1152,27 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.getMusicGenre = function (name, userId) { + + if (!name) { + throw new Error("null name"); + } + + var options = {}; + + if (userId) { + options.userId = userId; + } + + var url = self.getUrl("MusicGenres/" + self.encodeName(name), options); + + return self.ajax({ + type: "GET", + url: url, + dataType: "json" + }); + }; + /** * Gets an artist */ @@ -1425,6 +1446,41 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }; /** + * Constructs a url for a genre image + * @param {String} name + * @param {Object} options + * Options supports the following properties: + * width - download the image at a fixed width + * height - download the image at a fixed height + * maxWidth - download the image at a maxWidth + * maxHeight - download the image at a maxHeight + * quality - A scale of 0-100. This should almost always be omitted as the default will suffice. + * For best results do not specify both width and height together, as aspect ratio might be altered. + */ + self.getMusicGenreImageUrl = function (name, options) { + + if (!name) { + throw new Error("null name"); + } + + options = options || { + + }; + + var url = "MusicGenres/" + self.encodeName(name) + "/Images/" + options.type; + + if (options.index != null) { + url += "/" + options.index; + } + + // Don't put these on the query string + delete options.type; + delete options.index; + + return self.getUrl(url, options); + }; + + /** * Constructs a url for a artist image * @param {String} name * @param {Object} options @@ -1910,6 +1966,24 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.getMusicGenres = function (userId, options) { + + if (!userId) { + throw new Error("null userId"); + } + + options = options || {}; + options.userId = userId; + + var url = self.getUrl("MusicGenres", options); + + return self.ajax({ + type: "GET", + url: url, + dataType: "json" + }); + }; + /** Gets people from an item */ @@ -2217,6 +2291,26 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.updateFavoriteMusicGenreStatus = function (userId, name, isFavorite) { + + if (!userId) { + throw new Error("null userId"); + } + + if (!name) { + throw new Error("null name"); + } + + var url = self.getUrl("Users/" + userId + "/Favorites/MusicGenres/" + self.encodeName(name)); + + var method = isFavorite ? "POST" : "DELETE"; + + return self.ajax({ + type: method, + url: url + }); + }; + /** * Updates a user's rating for an item by name. * @param {String} userId @@ -2303,6 +2397,26 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.updateMusicGenreRating = function (userId, name, likes) { + + if (!userId) { + throw new Error("null userId"); + } + + if (!name) { + throw new Error("null name"); + } + + var url = self.getUrl("Users/" + userId + "/Ratings/MusicGenres/" + self.encodeName(name), { + likes: likes + }); + + return self.ajax({ + type: "POST", + url: url + }); + }; + /** * Clears a user's rating for an item by name. * @param {String} userId @@ -2380,6 +2494,24 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.clearMusicGenreRating = function (userId, name) { + + if (!userId) { + throw new Error("null userId"); + } + + if (!name) { + throw new Error("null name"); + } + + var url = self.getUrl("Users/" + userId + "/Ratings/MusicGenres/" + self.encodeName(name)); + + return self.ajax({ + type: "DELETE", + url: url + }); + }; + self.getItemCounts = function (userId) { var options = {}; @@ -2445,6 +2577,27 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.getMusicGenreItemCounts = function (userId, name) { + + if (!userId) { + throw new Error("null userId"); + } + + if (!name) { + throw new Error("null name"); + } + + var url = self.getUrl("MusicGenres/" + self.encodeName(name) + "/Counts", { + userId: userId + }); + + return self.ajax({ + type: "GET", + url: url, + dataType: "json" + }); + }; + /** Gets a variety of item counts that an artist appears in */ diff --git a/MediaBrowser.WebDashboard/packages.config b/MediaBrowser.WebDashboard/packages.config index 8590d6e8a..aedca5069 100644 --- a/MediaBrowser.WebDashboard/packages.config +++ b/MediaBrowser.WebDashboard/packages.config @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="MediaBrowser.ApiClient.Javascript" version="3.0.122" targetFramework="net45" /> + <package id="MediaBrowser.ApiClient.Javascript" version="3.0.123" targetFramework="net45" /> <package id="ServiceStack.Common" version="3.9.46" targetFramework="net45" /> <package id="ServiceStack.Text" version="3.9.45" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 129162c31..7a552b591 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common.Internal</id> - <version>3.0.120</version> + <version>3.0.121</version> <title>MediaBrowser.Common.Internal</title> <authors>Luke</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.120" /> + <dependency id="MediaBrowser.Common" version="3.0.121" /> <dependency id="NLog" version="2.0.1.2" /> <dependency id="ServiceStack.Text" version="3.9.45" /> <dependency id="SimpleInjector" version="2.2.3" /> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index a21a2d9e3..e563d85f5 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common</id> - <version>3.0.120</version> + <version>3.0.121</version> <title>MediaBrowser.Common</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index b69791a8f..1f755da57 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>MediaBrowser.Server.Core</id> - <version>3.0.120</version> + <version>3.0.121</version> <title>Media Browser.Server.Core</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains core components required to build plugins for Media Browser Server.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.120" /> + <dependency id="MediaBrowser.Common" version="3.0.121" /> </dependencies> </metadata> <files> |
