diff --git a/MediaBrowser.Api/ChannelService.cs b/MediaBrowser.Api/ChannelService.cs index bc3c11374a..2a2d316d3c 100644 --- a/MediaBrowser.Api/ChannelService.cs +++ b/MediaBrowser.Api/ChannelService.cs @@ -36,18 +36,27 @@ namespace MediaBrowser.Api public int? Limit { get; set; } } + [Route("/Channels/{Id}/Features", "GET", Summary = "Gets features for a channel")] + public class GetChannelFeatures : IReturn + { + [ApiMember(Name = "Id", Description = "Channel Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Id { get; set; } + } + [Route("/Channels/{Id}/Items", "GET", Summary = "Gets channel items")] public class GetChannelItems : IReturn> { + [ApiMember(Name = "Id", Description = "Channel Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] public string Id { get; set; } + [ApiMember(Name = "FolderId", Description = "Folder Id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string FolderId { get; set; } /// /// Gets or sets the user id. /// /// The user id. - [ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")] + [ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string UserId { get; set; } /// @@ -99,6 +108,13 @@ namespace MediaBrowser.Api _channelManager = channelManager; } + public object Get(GetChannelFeatures request) + { + var result = _channelManager.GetChannelFeatures(request.Id); + + return ToOptimizedResult(result); + } + public object Get(GetChannels request) { var result = _channelManager.GetChannels(new ChannelQuery diff --git a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs index 3b66e52ceb..5be30d7c3b 100644 --- a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs @@ -1,4 +1,5 @@ using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Channels; using MediaBrowser.Model.Configuration; using System.Collections.Generic; @@ -11,6 +12,7 @@ namespace MediaBrowser.Controller.Channels public string ChannelId { get; set; } public ChannelItemType ChannelItemType { get; set; } + public ChannelFolderType ChannelFolderType { get; set; } public string OriginalImageUrl { get; set; } public List Tags { get; set; } diff --git a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs index 66718d7cd6..707807bd5a 100644 --- a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs +++ b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs @@ -33,6 +33,7 @@ namespace MediaBrowser.Controller.Channels public string ImageUrl { get; set; } public ChannelMediaType MediaType { get; set; } + public ChannelFolderType FolderType { get; set; } public ChannelMediaContentType ContentType { get; set; } diff --git a/MediaBrowser.Controller/Channels/IChannel.cs b/MediaBrowser.Controller/Channels/IChannel.cs index 7f03579f35..799df91820 100644 --- a/MediaBrowser.Controller/Channels/IChannel.cs +++ b/MediaBrowser.Controller/Channels/IChannel.cs @@ -58,14 +58,6 @@ namespace MediaBrowser.Controller.Channels /// Task{IEnumerable{ChannelItem}}. Task GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken); - /// - /// Gets all media. - /// - /// The query. - /// The cancellation token. - /// Task{ChannelItemResult}. - Task GetAllMedia(InternalAllChannelItemsQuery query, CancellationToken cancellationToken); - /// /// Gets the channel image. /// diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs index 9ffe438274..4c2d665e54 100644 --- a/MediaBrowser.Controller/Channels/IChannelManager.cs +++ b/MediaBrowser.Controller/Channels/IChannelManager.cs @@ -16,6 +16,13 @@ namespace MediaBrowser.Controller.Channels /// The factories. void AddParts(IEnumerable channels, IEnumerable factories); + /// + /// Gets the channel features. + /// + /// The identifier. + /// ChannelFeatures. + ChannelFeatures GetChannelFeatures(string id); + /// /// Gets the channel. /// diff --git a/MediaBrowser.Model/Channels/ChannelFeatures.cs b/MediaBrowser.Model/Channels/ChannelFeatures.cs index dbfab87db0..d3af8dadf5 100644 --- a/MediaBrowser.Model/Channels/ChannelFeatures.cs +++ b/MediaBrowser.Model/Channels/ChannelFeatures.cs @@ -10,12 +10,6 @@ namespace MediaBrowser.Model.Channels /// true if this instance can search; otherwise, false. public bool CanSearch { get; set; } - /// - /// Gets or sets a value indicating whether this instance can index all media. - /// - /// true if this instance can index all media; otherwise, false. - public bool CanGetAllMedia { get; set; } - /// /// Gets or sets the media types. /// @@ -33,11 +27,39 @@ namespace MediaBrowser.Model.Channels /// public int? MaxPageSize { get; set; } + /// + /// Gets or sets the default sort orders. + /// + /// The default sort orders. + public List DefaultSortFields { get; set; } + + /// + /// Indicates if a sort ascending/descending toggle is supported or not. + /// + public bool SupportsSortOrderToggle { get; set; } + + /// + /// Gets or sets a value indicating whether the channel content is just a single media list. + /// + /// true if this instance is single media list; otherwise, false. + public bool IsSingleMediaList { get; set; } + public ChannelFeatures() { MediaTypes = new List(); ContentTypes = new List(); + + DefaultSortFields = new List(); } } + public enum ChannelItemSortField + { + Name = 0, + CommunityRating = 1, + ReleaseDate = 2, + Runtime = 3, + CommunityMostWatched = 4, + UserPlayCount = 5 + } } diff --git a/MediaBrowser.Model/Channels/ChannelMediaType.cs b/MediaBrowser.Model/Channels/ChannelMediaType.cs index 102cb66447..cf3239c9b7 100644 --- a/MediaBrowser.Model/Channels/ChannelMediaType.cs +++ b/MediaBrowser.Model/Channels/ChannelMediaType.cs @@ -8,4 +8,13 @@ Photo = 2 } + + public enum ChannelFolderType + { + Container = 0, + + MusicAlbum = 1, + + PhotoAlbum = 2 + } } \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index 355ac43fcb..572db8332c 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -237,6 +237,15 @@ namespace MediaBrowser.Server.Implementations.Channels return (Channel)_libraryManager.GetItemById(new Guid(id)); } + public ChannelFeatures GetChannelFeatures(string id) + { + var channel = GetChannel(id); + + var channelProvider = GetChannelProvider(channel); + + return channelProvider.GetChannelFeatures(); + } + private Guid GetInternalChannelId(string name) { if (string.IsNullOrWhiteSpace(name)) @@ -267,7 +276,7 @@ namespace MediaBrowser.Server.Implementations.Channels if (query.Limit.HasValue && query.Limit.Value > channelInfo.MaxPageSize.Value) { - throw new ArgumentException(string.Format("Channel {0} only supports a maximum of {1} records at a time.", channel.Name, channelInfo.MaxPageSize.Value)); + throw new ArgumentException(string.Format("{0} channel only supports a maximum of {1} records at a time.", channel.Name, channelInfo.MaxPageSize.Value)); } providerLimit = query.Limit; } diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 2f54f79522..faa86f775c 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.378 + 3.0.382 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 4155976b47..cb59c7afa3 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.378 + 3.0.382 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 38111ed1ad..bfb9a547a7 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.378 + 3.0.382 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +