You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Api/Movies/TrailersService.cs

84 lines
2.6 KiB

using MediaBrowser.Api.UserLibrary;
using MediaBrowser.Controller.Configuration;
10 years ago
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Querying;
8 years ago
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Movies
{
10 years ago
[Route("/Trailers", "GET", Summary = "Finds movies and trailers similar to a given trailer.")]
public class Getrailers : BaseItemsRequest, IReturn<QueryResult<BaseItemDto>>
10 years ago
{
}
/// <summary>
/// Class TrailersService
/// </summary>
[Authenticated]
public class TrailersService : BaseApiService
{
/// <summary>
/// The _user manager
/// </summary>
private readonly IUserManager _userManager;
/// <summary>
/// The _library manager
/// </summary>
private readonly ILibraryManager _libraryManager;
11 years ago
private readonly IDtoService _dtoService;
8 years ago
private readonly ILocalizationManager _localizationManager;
private readonly IJsonSerializer _json;
private readonly IAuthorizationContext _authContext;
11 years ago
public TrailersService(
ILogger<TrailersService> logger,
IServerConfigurationManager serverConfigurationManager,
IHttpResultFactory httpResultFactory,
IUserManager userManager,
ILibraryManager libraryManager,
IDtoService dtoService,
ILocalizationManager localizationManager,
IJsonSerializer json,
IAuthorizationContext authContext)
: base(logger, serverConfigurationManager, httpResultFactory)
{
_userManager = userManager;
_libraryManager = libraryManager;
11 years ago
_dtoService = dtoService;
8 years ago
_localizationManager = localizationManager;
_json = json;
_authContext = authContext;
}
8 years ago
public object Get(Getrailers request)
10 years ago
{
8 years ago
var json = _json.SerializeToString(request);
var getItems = _json.DeserializeFromString<GetItems>(json);
10 years ago
8 years ago
getItems.IncludeItemTypes = "Trailer";
10 years ago
return new ItemsService(
Logger,
ServerConfigurationManager,
ResultFactory,
_userManager,
_libraryManager,
_localizationManager,
_dtoService,
_authContext)
10 years ago
{
8 years ago
Request = Request,
10 years ago
8 years ago
}.Get(getItems);
10 years ago
}
}
}