diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj
index 18559a68df..c03eddf99e 100644
--- a/MediaBrowser.Api/MediaBrowser.Api.csproj
+++ b/MediaBrowser.Api/MediaBrowser.Api.csproj
@@ -103,6 +103,7 @@
+
diff --git a/MediaBrowser.Api/Music/InstantMixService.cs b/MediaBrowser.Api/Music/InstantMixService.cs
index 9b9df3a92c..c39811bb66 100644
--- a/MediaBrowser.Api/Music/InstantMixService.cs
+++ b/MediaBrowser.Api/Music/InstantMixService.cs
@@ -1,9 +1,9 @@
using MediaBrowser.Controller.Dto;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Querying;
using ServiceStack;
-using System;
using System.Collections.Generic;
using System.Linq;
@@ -36,103 +36,74 @@ namespace MediaBrowser.Api.Music
public class InstantMixService : BaseApiService
{
private readonly IUserManager _userManager;
- private readonly ILibraryManager _libraryManager;
private readonly IDtoService _dtoService;
+ private readonly IMusicManager _musicManager;
- public InstantMixService(IUserManager userManager, ILibraryManager libraryManager, IDtoService dtoService)
+ public InstantMixService(IUserManager userManager, IDtoService dtoService, IMusicManager musicManager)
{
_userManager = userManager;
- _libraryManager = libraryManager;
_dtoService = dtoService;
+ _musicManager = musicManager;
}
public object Get(GetInstantMixFromSong request)
{
- var item = _dtoService.GetItemByDtoId(request.Id);
+ var item = (Audio)_dtoService.GetItemByDtoId(request.Id);
- var result = GetInstantMixResult(request, item.Genres);
+ var user = _userManager.GetUserById(request.UserId.Value);
- return ToOptimizedSerializedResultUsingCache(result);
+ var items = _musicManager.GetInstantMixFromSong(item, user);
+
+ return GetResult(items, user, request);
}
public object Get(GetInstantMixFromAlbum request)
{
var album = (MusicAlbum)_dtoService.GetItemByDtoId(request.Id);
- var genres = album
- .RecursiveChildren
- .OfType