2019-01-13 20:01:16 +00:00
|
|
|
using MediaBrowser.Api.UserLibrary;
|
2019-11-17 22:05:39 +00:00
|
|
|
using MediaBrowser.Controller.Configuration;
|
2014-10-20 20:23:40 +00:00
|
|
|
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;
|
2017-08-19 19:43:35 +00:00
|
|
|
using MediaBrowser.Model.Dto;
|
2016-10-24 02:45:23 +00:00
|
|
|
using MediaBrowser.Model.Globalization;
|
2019-01-13 19:24:58 +00:00
|
|
|
using MediaBrowser.Model.Querying;
|
2016-03-20 03:38:02 +00:00
|
|
|
using MediaBrowser.Model.Serialization;
|
2016-10-25 19:02:04 +00:00
|
|
|
using MediaBrowser.Model.Services;
|
2019-11-17 22:05:39 +00:00
|
|
|
using Microsoft.Extensions.Logging;
|
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.")]
|
2017-08-19 19:43:35 +00:00
|
|
|
public class Getrailers : BaseItemsRequest, IReturn<QueryResult<BaseItemDto>>
|
2014-10-20 20:23:40 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-05-25 23:52:41 +00:00
|
|
|
/// <summary>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Class TrailersService.
|
2013-05-25 23:52:41 +00:00
|
|
|
/// </summary>
|
2014-07-02 18:34:08 +00:00
|
|
|
[Authenticated]
|
2013-05-25 23:52:41 +00:00
|
|
|
public class TrailersService : BaseApiService
|
|
|
|
{
|
|
|
|
/// <summary>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// The _user manager.
|
2013-05-25 23:52:41 +00:00
|
|
|
/// </summary>
|
|
|
|
private readonly IUserManager _userManager;
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// The _library manager.
|
2013-05-25 23:52:41 +00:00
|
|
|
/// </summary>
|
|
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
|
|
2020-05-12 20:03:15 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The logger for the created <see cref="ItemsService"/> instances.
|
|
|
|
/// </summary>
|
|
|
|
private readonly ILogger<ItemsService> _logger;
|
|
|
|
|
2013-09-04 17:02:19 +00:00
|
|
|
private readonly IDtoService _dtoService;
|
2016-03-20 03:38:02 +00:00
|
|
|
private readonly ILocalizationManager _localizationManager;
|
|
|
|
private readonly IJsonSerializer _json;
|
2016-11-10 14:41:24 +00:00
|
|
|
private readonly IAuthorizationContext _authContext;
|
2013-09-04 17:02:19 +00:00
|
|
|
|
2019-11-17 22:05:39 +00:00
|
|
|
public TrailersService(
|
2020-05-12 20:03:15 +00:00
|
|
|
ILoggerFactory loggerFactory,
|
2019-11-17 22:05:39 +00:00
|
|
|
IServerConfigurationManager serverConfigurationManager,
|
|
|
|
IHttpResultFactory httpResultFactory,
|
|
|
|
IUserManager userManager,
|
|
|
|
ILibraryManager libraryManager,
|
|
|
|
IDtoService dtoService,
|
|
|
|
ILocalizationManager localizationManager,
|
|
|
|
IJsonSerializer json,
|
|
|
|
IAuthorizationContext authContext)
|
2020-05-12 20:03:15 +00:00
|
|
|
: base(loggerFactory.CreateLogger<TrailersService>(), serverConfigurationManager, httpResultFactory)
|
2013-05-25 23:52:41 +00:00
|
|
|
{
|
|
|
|
_userManager = userManager;
|
|
|
|
_libraryManager = libraryManager;
|
2013-09-04 17:02:19 +00:00
|
|
|
_dtoService = dtoService;
|
2016-03-20 03:38:02 +00:00
|
|
|
_localizationManager = localizationManager;
|
|
|
|
_json = json;
|
2016-11-10 14:41:24 +00:00
|
|
|
_authContext = authContext;
|
2020-05-12 20:03:15 +00:00
|
|
|
_logger = loggerFactory.CreateLogger<ItemsService>();
|
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
|
|
|
|
2019-11-17 22:05:39 +00:00
|
|
|
return new ItemsService(
|
2020-05-12 20:03:15 +00:00
|
|
|
_logger,
|
2019-11-17 22:05:39 +00:00
|
|
|
ServerConfigurationManager,
|
|
|
|
ResultFactory,
|
|
|
|
_userManager,
|
|
|
|
_libraryManager,
|
|
|
|
_localizationManager,
|
|
|
|
_dtoService,
|
|
|
|
_authContext)
|
2014-10-20 20:23:40 +00:00
|
|
|
{
|
2016-03-20 03:38:02 +00:00
|
|
|
Request = Request,
|
|
|
|
}.Get(getItems);
|
2014-10-20 20:23:40 +00:00
|
|
|
}
|
2013-05-25 23:52:41 +00:00
|
|
|
}
|
|
|
|
}
|