The Free Software Media System - Server Backend & API
updated nuget
Luke Pulverenti680ffeebf7bc
diff --git a/MediaBrowser.Api/ChannelService.cs b/MediaBrowser.Api/ChannelService.csindex bc3c11374a..2a2d316d3c 100644--- a/MediaBrowser.Api/ChannelService.cs+++ b/MediaBrowser.Api/ChannelService.cs@@ -36,18 +36,27 @@ namespace MediaBrowser.Apipublic int? Limit { get; set; }}+ [Route("/Channels/{Id}/Features", "GET", Summary = "Gets features for a channel")]+ public class GetChannelFeatures : IReturn<ChannelFeatures>+ {+ [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<QueryResult<BaseItemDto>>{+ [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; }/// <summary>/// Gets or sets the user id./// </summary>/// <value>The user id.</value>- [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; }/// <summary>@@ -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 ChannelQuerydiff --git a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs b/MediaBrowser.Controller/Channels/ChannelFolderItem.csindex 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.Channelspublic string ChannelId { get; set; }public ChannelItemType ChannelItemType { get; set; }+ public ChannelFolderType ChannelFolderType { get; set; }public string OriginalImageUrl { get; set; }public List<string> Tags { get; set; }diff --git a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs b/MediaBrowser.Controller/Channels/ChannelItemInfo.csindex 66718d7cd6..707807bd5a 100644--- a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs+++ b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs@@ -33,6 +33,7 @@ namespace MediaBrowser.Controller.Channelspublic 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.csindex 7f03579f35..799df91820 100644--- a/MediaBrowser.Controller/Channels/IChannel.cs+++ b/MediaBrowser.Controller/Channels/IChannel.cs@@ -58,14 +58,6 @@ namespace MediaBrowser.Controller.Channels/// <returns>Task{IEnumerable{ChannelItem}}.</returns>Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken);- /// <summary>- /// Gets all media.- /// </summary>- /// <param name="query">The query.</param>- /// <param name="cancellationToken">The cancellation token.</param>- /// <returns>Task{ChannelItemResult}.</returns>- Task<ChannelItemResult> GetAllMedia(InternalAllChannelItemsQuery query, CancellationToken cancellationToken);-/// <summary>/// Gets the channel image./// </summary>diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.csindex 9ffe438274..4c2d665e54 100644--- a/MediaBrowser.Controller/Channels/IChannelManager.cs+++ b/MediaBrowser.Controller/Channels/IChannelManager.cs@@ -16,6 +16,13 @@ namespace MediaBrowser.Controller.Channels/// <param name="factories">The factories.</param>void AddParts(IEnumerable<IChannel> channels, IEnumerable<IChannelFactory> factories);+ /// <summary>+ /// Gets the channel features.+ /// </summary>+ /// <param name="id">The identifier.</param>+ /// <returns>ChannelFeatures.</returns>+ ChannelFeatures GetChannelFeatures(string id);+/// <summary>/// Gets the channel./// </summary>diff --git a/MediaBrowser.Model/Channels/ChannelFeatures.cs b/MediaBrowser.Model/Channels/ChannelFeatures.csindex dbfab87db0..d3af8dadf5 100644--- a/MediaBrowser.Model/Channels/ChannelFeatures.cs+++ b/MediaBrowser.Model/Channels/ChannelFeatures.cs@@ -10,12 +10,6 @@ namespace MediaBrowser.Model.Channels/// <value><c>true</c> if this instance can search; otherwise, <c>false</c>.</value>public bool CanSearch { get; set; }- /// <summary>- /// Gets or sets a value indicating whether this instance can index all media.- /// </summary>- /// <value><c>true</c> if this instance can index all media; otherwise, <c>false</c>.</value>- public bool CanGetAllMedia { get; set; }-/// <summary>/// Gets or sets the media types./// </summary>@@ -33,11 +27,39 @@ namespace MediaBrowser.Model.Channels/// </summary>public int? MaxPageSize { get; set; }+ /// <summary>+ /// Gets or sets the default sort orders.+ /// </summary>+ /// <value>The default sort orders.</value>+ public List<ChannelItemSortField> DefaultSortFields { get; set; }++ /// <summary>+ /// Indicates if a sort ascending/descending toggle is supported or not.+ /// </summary>+ public bool SupportsSortOrderToggle { get; set; }++ /// <summary>+ /// Gets or sets a value indicating whether the channel content is just a single media list.+ /// </summary>+ /// <value><c>true</c> if this instance is single media list; otherwise, <c>false</c>.</value>+ public bool IsSingleMediaList { get; set; }+public ChannelFeatures(){MediaTypes = new List<ChannelMediaType>();ContentTypes = new List<ChannelMediaContentType>();++ DefaultSortFields = new List<ChannelItemSortField>();}}+ 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.csindex 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 filediff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.csindex 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.Channelsreturn (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.Channelsif (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.nuspecindex 2f54f79522..faa86f775c 100644--- a/Nuget/MediaBrowser.Common.Internal.nuspec+++ b/Nuget/MediaBrowser.Common.Internal.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common.Internal</id>- <version>3.0.378</version>+ <version>3.0.382</version><title>MediaBrowser.Common.Internal</title><authors>Luke</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.378" />+ <dependency id="MediaBrowser.Common" version="3.0.382" /><dependency id="NLog" version="2.1.0" /><dependency id="SimpleInjector" version="2.5.0" /><dependency id="sharpcompress" version="0.10.2" />diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspecindex 4155976b47..cb59c7afa3 100644--- a/Nuget/MediaBrowser.Common.nuspec+++ b/Nuget/MediaBrowser.Common.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common</id>- <version>3.0.378</version>+ <version>3.0.382</version><title>MediaBrowser.Common</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspecindex 38111ed1ad..bfb9a547a7 100644--- a/Nuget/MediaBrowser.Server.Core.nuspec+++ b/Nuget/MediaBrowser.Server.Core.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"><metadata><id>MediaBrowser.Server.Core</id>- <version>3.0.378</version>+ <version>3.0.382</version><title>Media Browser.Server.Core</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains core components required to build plugins for Media Browser Server.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.378" />+ <dependency id="MediaBrowser.Common" version="3.0.382" /></dependencies></metadata><files>