using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using ServiceStack.ServiceHost; namespace MediaBrowser.Api { /// /// Class GetSimilarMovies /// [Route("/Movies/{Id}/Similar", "GET")] [Api(Description = "Finds movies and trailers similar to a given movie.")] public class GetSimilarMovies : BaseGetSimilarItems { } /// /// Class MoviesService /// public class MoviesService : BaseApiService { /// /// The _user manager /// private readonly IUserManager _userManager; /// /// The _user data repository /// private readonly IUserDataRepository _userDataRepository; /// /// The _library manager /// private readonly ILibraryManager _libraryManager; /// /// Initializes a new instance of the class. /// /// The user manager. /// The user data repository. /// The library manager. public MoviesService(IUserManager userManager, IUserDataRepository userDataRepository, ILibraryManager libraryManager) { _userManager = userManager; _userDataRepository = userDataRepository; _libraryManager = libraryManager; } /// /// Gets the specified request. /// /// The request. /// System.Object. public object Get(GetSimilarMovies request) { var result = SimilarItemsHelper.GetSimilarItems(_userManager, _libraryManager, _userDataRepository, Logger, request, item => item is Movie || item is Trailer, SimilarItemsHelper.GetSimiliarityScore); return ToOptimizedResult(result); } } }