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

73 lines
2.5 KiB

10 years ago
using MediaBrowser.Api.UserLibrary;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
10 years ago
using MediaBrowser.Model.Querying;
using ServiceStack;
9 years ago
using MediaBrowser.Controller.Collections;
using MediaBrowser.Controller.Localization;
using MediaBrowser.Model.Serialization;
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<ItemsResult>
{
}
/// <summary>
/// Class TrailersService
/// </summary>
[Authenticated]
public class TrailersService : BaseApiService
{
/// <summary>
/// The _user manager
/// </summary>
private readonly IUserManager _userManager;
/// <summary>
/// The _user data repository
/// </summary>
private readonly IUserDataManager _userDataRepository;
/// <summary>
/// The _library manager
/// </summary>
private readonly ILibraryManager _libraryManager;
11 years ago
private readonly IDtoService _dtoService;
9 years ago
private readonly ICollectionManager _collectionManager;
private readonly ILocalizationManager _localizationManager;
private readonly IJsonSerializer _json;
11 years ago
9 years ago
public TrailersService(IUserManager userManager, IUserDataManager userDataRepository, ILibraryManager libraryManager, IDtoService dtoService, ICollectionManager collectionManager, ILocalizationManager localizationManager, IJsonSerializer json)
{
_userManager = userManager;
_userDataRepository = userDataRepository;
_libraryManager = libraryManager;
11 years ago
_dtoService = dtoService;
9 years ago
_collectionManager = collectionManager;
_localizationManager = localizationManager;
_json = json;
}
9 years ago
public object Get(Getrailers request)
10 years ago
{
9 years ago
var json = _json.SerializeToString(request);
var getItems = _json.DeserializeFromString<GetItems>(json);
10 years ago
9 years ago
getItems.IncludeItemTypes = "Trailer";
10 years ago
9 years ago
return new ItemsService(_userManager, _libraryManager, _userDataRepository, _localizationManager, _dtoService, _collectionManager)
10 years ago
{
9 years ago
AuthorizationContext = AuthorizationContext,
Logger = Logger,
Request = Request,
ResultFactory = ResultFactory,
SessionContext = SessionContext
10 years ago
9 years ago
}.Get(getItems);
10 years ago
}
}
}