added a new MusicGenre entity
This commit is contained in:
parent
fab983b6dc
commit
18325159c5
|
@ -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));
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
166
MediaBrowser.Api/UserLibrary/MusicGenresService.cs
Normal file
166
MediaBrowser.Api/UserLibrary/MusicGenresService.cs
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
18
MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
Normal file
18
MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,6 +40,12 @@ namespace MediaBrowser.Controller
|
|||
/// <value>The genre path.</value>
|
||||
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>
|
||||
|
|
|
@ -81,6 +81,14 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <returns>Task{Genre}.</returns>
|
||||
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>
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -634,6 +634,17 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
return GetItemByName<Genre>(ConfigurationManager.ApplicationPaths.GenrePath, name, CancellationToken.None, allowSlowProviders);
|
||||
}
|
||||
|
||||
/// <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>
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -106,6 +106,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>
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
@ -1424,6 +1445,41 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||
return self.getUrl(url, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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>
|
|
@ -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" />
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user