diff --git a/MediaBrowser.Api/ChannelService.cs b/MediaBrowser.Api/ChannelService.cs index aa8fc9e52..c1724571a 100644 --- a/MediaBrowser.Api/ChannelService.cs +++ b/MediaBrowser.Api/ChannelService.cs @@ -18,6 +18,21 @@ namespace MediaBrowser.Api public int? Limit { get; set; } } + [Route("/Channels/{Id}/Items", "GET")] + [Api(("Gets channel items"))] + public class GetChannelItems : IReturn> + { + public string Id { get; set; } + + public string CategoryId { get; set; } + + public string UserId { get; set; } + + public int? StartIndex { get; set; } + + public int? Limit { get; set; } + } + public class ChannelService : BaseApiService { private readonly IChannelManager _channelManager; @@ -39,5 +54,20 @@ namespace MediaBrowser.Api return ToOptimizedResult(result); } + + public object Get(GetChannelItems request) + { + var result = _channelManager.GetChannelItems(new ChannelItemQuery + { + Limit = request.Limit, + StartIndex = request.StartIndex, + UserId = request.UserId, + ChannelId = request.Id, + CategoryId = request.CategoryId + + }, CancellationToken.None).Result; + + return ToOptimizedResult(result); + } } } diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index c3fdbb9a0..dba256418 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Extensions; +using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -6,6 +7,7 @@ using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; +using MediaBrowser.Model.Channels; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; @@ -242,18 +244,20 @@ namespace MediaBrowser.Api.Library private readonly IUserDataManager _userDataManager; private readonly IDtoService _dtoService; + private readonly IChannelManager _channelManager; /// /// Initializes a new instance of the class. /// public LibraryService(IItemRepository itemRepo, ILibraryManager libraryManager, IUserManager userManager, - IDtoService dtoService, IUserDataManager userDataManager) + IDtoService dtoService, IUserDataManager userDataManager, IChannelManager channelManager) { _itemRepo = itemRepo; _libraryManager = libraryManager; _userManager = userManager; _dtoService = dtoService; _userDataManager = userDataManager; + _channelManager = channelManager; } public object Get(GetMediaFolders request) @@ -417,6 +421,21 @@ namespace MediaBrowser.Api.Library var songs = filteredItems.OfType