diff --git a/MediaBrowser.Api/GamesService.cs b/MediaBrowser.Api/GamesService.cs
index 387771b6d5..cb77e62adf 100644
--- a/MediaBrowser.Api/GamesService.cs
+++ b/MediaBrowser.Api/GamesService.cs
@@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
+using MediaBrowser.Model.Querying;
namespace MediaBrowser.Api
{
@@ -187,18 +188,40 @@ namespace MediaBrowser.Api
/// System.Object.
public object Get(GetSimilarGames request)
{
+ var result = GetSimilarItemsResult(request);
+
+ return ToOptimizedSerializedResultUsingCache(result);
+ }
+
+ private QueryResult GetSimilarItemsResult(BaseGetSimilarItemsFromItem request)
+ {
+ var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
+
+ var item = string.IsNullOrEmpty(request.Id) ?
+ (!string.IsNullOrWhiteSpace(request.UserId) ? user.RootFolder :
+ _libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id);
+
+ var itemsResult = _libraryManager.GetItemList(new InternalItemsQuery(user)
+ {
+ Limit = request.Limit,
+ IncludeItemTypes = new[]
+ {
+ typeof(Game).Name
+ },
+ SimilarTo = item
+
+ }).ToList();
+
var dtoOptions = GetDtoOptions(request);
- var result = SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager,
- _itemRepo,
- _libraryManager,
- _userDataRepository,
- _dtoService,
- Logger,
- request, new[] { typeof(Game) },
- SimilarItemsHelper.GetSimiliarityScore);
+ var result = new QueryResult
+ {
+ Items = _dtoService.GetBaseItemDtos(itemsResult, dtoOptions, user).ToArray(),
- return ToOptimizedSerializedResultUsingCache(result);
+ TotalRecordCount = itemsResult.Count
+ };
+
+ return result;
}
}
}
diff --git a/MediaBrowser.Api/Movies/MoviesService.cs b/MediaBrowser.Api/Movies/MoviesService.cs
index ce36dd2ac9..ff18d440c1 100644
--- a/MediaBrowser.Api/Movies/MoviesService.cs
+++ b/MediaBrowser.Api/Movies/MoviesService.cs
@@ -111,18 +111,16 @@ namespace MediaBrowser.Api.Movies
///
/// The request.
/// System.Object.
- public async Task