2014-10-20 20:23:40 +00:00
|
|
|
|
using MediaBrowser.Api.UserLibrary;
|
|
|
|
|
using MediaBrowser.Controller.Dto;
|
2013-05-25 23:52:41 +00:00
|
|
|
|
using MediaBrowser.Controller.Library;
|
2014-07-02 18:34:08 +00:00
|
|
|
|
using MediaBrowser.Controller.Net;
|
2014-10-20 20:23:40 +00:00
|
|
|
|
using MediaBrowser.Model.Querying;
|
2013-12-07 15:52:38 +00:00
|
|
|
|
using ServiceStack;
|
2016-03-20 03:38:02 +00:00
|
|
|
|
using MediaBrowser.Controller.Collections;
|
|
|
|
|
using MediaBrowser.Controller.Localization;
|
|
|
|
|
using MediaBrowser.Model.Serialization;
|
2013-05-25 23:52:41 +00:00
|
|
|
|
|
2014-03-07 15:53:23 +00:00
|
|
|
|
namespace MediaBrowser.Api.Movies
|
2013-05-25 23:52:41 +00:00
|
|
|
|
{
|
2014-10-20 20:23:40 +00:00
|
|
|
|
[Route("/Trailers", "GET", Summary = "Finds movies and trailers similar to a given trailer.")]
|
|
|
|
|
public class Getrailers : BaseItemsRequest, IReturn<ItemsResult>
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-25 23:52:41 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class TrailersService
|
|
|
|
|
/// </summary>
|
2014-07-02 18:34:08 +00:00
|
|
|
|
[Authenticated]
|
2013-05-25 23:52:41 +00:00
|
|
|
|
public class TrailersService : BaseApiService
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The _user manager
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly IUserManager _userManager;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The _user data repository
|
|
|
|
|
/// </summary>
|
2013-10-02 16:08:58 +00:00
|
|
|
|
private readonly IUserDataManager _userDataRepository;
|
2013-05-25 23:52:41 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The _library manager
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
|
|
|
2013-09-04 17:02:19 +00:00
|
|
|
|
private readonly IDtoService _dtoService;
|
2016-03-20 03:38:02 +00:00
|
|
|
|
private readonly ICollectionManager _collectionManager;
|
|
|
|
|
private readonly ILocalizationManager _localizationManager;
|
|
|
|
|
private readonly IJsonSerializer _json;
|
2013-09-04 17:02:19 +00:00
|
|
|
|
|
2016-03-20 03:38:02 +00:00
|
|
|
|
public TrailersService(IUserManager userManager, IUserDataManager userDataRepository, ILibraryManager libraryManager, IDtoService dtoService, ICollectionManager collectionManager, ILocalizationManager localizationManager, IJsonSerializer json)
|
2013-05-25 23:52:41 +00:00
|
|
|
|
{
|
|
|
|
|
_userManager = userManager;
|
|
|
|
|
_userDataRepository = userDataRepository;
|
|
|
|
|
_libraryManager = libraryManager;
|
2013-09-04 17:02:19 +00:00
|
|
|
|
_dtoService = dtoService;
|
2016-03-20 03:38:02 +00:00
|
|
|
|
_collectionManager = collectionManager;
|
|
|
|
|
_localizationManager = localizationManager;
|
|
|
|
|
_json = json;
|
2013-05-25 23:52:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-20 03:38:02 +00:00
|
|
|
|
public object Get(Getrailers request)
|
2014-10-20 20:23:40 +00:00
|
|
|
|
{
|
2016-03-20 03:38:02 +00:00
|
|
|
|
var json = _json.SerializeToString(request);
|
|
|
|
|
var getItems = _json.DeserializeFromString<GetItems>(json);
|
2014-10-20 20:23:40 +00:00
|
|
|
|
|
2016-03-20 03:38:02 +00:00
|
|
|
|
getItems.IncludeItemTypes = "Trailer";
|
2014-10-20 20:23:40 +00:00
|
|
|
|
|
2016-03-20 03:38:02 +00:00
|
|
|
|
return new ItemsService(_userManager, _libraryManager, _userDataRepository, _localizationManager, _dtoService, _collectionManager)
|
2014-10-20 20:23:40 +00:00
|
|
|
|
{
|
2016-03-20 03:38:02 +00:00
|
|
|
|
AuthorizationContext = AuthorizationContext,
|
|
|
|
|
Logger = Logger,
|
|
|
|
|
Request = Request,
|
|
|
|
|
ResultFactory = ResultFactory,
|
|
|
|
|
SessionContext = SessionContext
|
2014-10-20 20:23:40 +00:00
|
|
|
|
|
2016-03-20 03:38:02 +00:00
|
|
|
|
}.Get(getItems);
|
2014-10-20 20:23:40 +00:00
|
|
|
|
}
|
2013-05-25 23:52:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|