diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs index 22212d287f..35411935b3 100644 --- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs +++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs @@ -336,6 +336,28 @@ namespace MediaBrowser.Api.UserLibrary public string Id { get; set; } } + /// + /// Class GetVideoBackdrops + /// + [Route("/Users/{UserId}/Items/{Id}/VideoBackdrops", "GET")] + [Api(Description = "Gets video backdrops for an item")] + public class GetVideoBackdrops : IReturn + { + /// + /// Gets or sets the user id. + /// + /// The user id. + [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public Guid UserId { get; set; } + + /// + /// Gets or sets the id. + /// + /// The id. + [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Id { get; set; } + } + /// /// Class GetSpecialFeatures /// @@ -464,6 +486,34 @@ namespace MediaBrowser.Api.UserLibrary return ToOptimizedResult(result); } + /// + /// Gets the specified request. + /// + /// The request. + /// System.Object. + public object Get(GetVideoBackdrops request) + { + var user = _userManager.GetUserById(request.UserId); + + var item = string.IsNullOrEmpty(request.Id) ? user.RootFolder : DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id); + + // Get everything + var fields = Enum.GetNames(typeof(ItemFields)).Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)).ToList(); + + var dtoBuilder = new DtoBuilder(Logger, _libraryManager, _userDataRepository); + + var items = item.VideoBackdrops.Select(i => dtoBuilder.GetBaseItemDto(i, user, fields)).AsParallel().Select(t => t.Result).ToArray(); + + var result = new VideoBackdropsResult + { + Items = items, + TotalRecordCount = items.Length, + OwnerId = DtoBuilder.GetClientItemId(item) + }; + + return ToOptimizedResult(result); + } + /// /// Gets the specified request. /// diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index eca0ea4629..8da67cb69f 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -39,6 +39,7 @@ namespace MediaBrowser.Controller.Entities /// public const string TrailerFolderName = "trailers"; public const string ThemeSongsFolderName = "theme-music"; + public const string VideoBackdropsFolderName = "backdrops"; /// /// Gets or sets the name. @@ -702,6 +703,28 @@ namespace MediaBrowser.Controller.Entities } } + private List