improved instant mix algorithm

This commit is contained in:
Luke Pulverenti 2013-08-09 12:33:12 -04:00
parent 2173ab0f9f
commit 9f0405b9a0

View File

@ -66,9 +66,16 @@ namespace MediaBrowser.Api
public object Get(GetInstantMixFromAlbum request) public object Get(GetInstantMixFromAlbum request)
{ {
var item = DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager); var album = (MusicAlbum)DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager);
var result = GetInstantMixResult(request, item.Genres).Result; var genres = album
.RecursiveChildren
.OfType<Audio>()
.SelectMany(i => i.Genres)
.Concat(album.Genres)
.Distinct(StringComparer.OrdinalIgnoreCase);
var result = GetInstantMixResult(request, genres).Result;
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
@ -91,6 +98,7 @@ namespace MediaBrowser.Api
.OfType<Audio>() .OfType<Audio>()
.Where(i => i.HasArtist(artist.Name)) .Where(i => i.HasArtist(artist.Name))
.SelectMany(i => i.Genres) .SelectMany(i => i.Genres)
.Concat(artist.Genres)
.Distinct(StringComparer.OrdinalIgnoreCase); .Distinct(StringComparer.OrdinalIgnoreCase);
var result = GetInstantMixResult(request, genres).Result; var result = GetInstantMixResult(request, genres).Result;