From ce8c5a1a3cc678c1e5dc4bd8a8f811895891fff9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 27 May 2014 13:57:29 -0400 Subject: [PATCH] add more channel feature reporting --- MediaBrowser.Controller/Channels/IChannel.cs | 3 +- .../Channels/InternalChannelFeatures.cs | 50 +++++++++++++++++++ .../Channels/InternalChannelItemQuery.cs | 15 ++---- .../MediaBrowser.Controller.csproj | 1 + .../Channels/ChannelFeatures.cs | 15 +++--- .../Channels/ChannelManager.cs | 16 +++++- .../Localization/Server/server.json | 4 +- Nuget/MediaBrowser.Common.Internal.nuspec | 4 +- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +- 10 files changed, 88 insertions(+), 26 deletions(-) create mode 100644 MediaBrowser.Controller/Channels/InternalChannelFeatures.cs diff --git a/MediaBrowser.Controller/Channels/IChannel.cs b/MediaBrowser.Controller/Channels/IChannel.cs index 799df9182..27334e4b9 100644 --- a/MediaBrowser.Controller/Channels/IChannel.cs +++ b/MediaBrowser.Controller/Channels/IChannel.cs @@ -1,6 +1,5 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Channels; using MediaBrowser.Model.Entities; using System.Collections.Generic; using System.Threading; @@ -32,7 +31,7 @@ namespace MediaBrowser.Controller.Channels /// Gets the channel information. /// /// ChannelFeatures. - ChannelFeatures GetChannelFeatures(); + InternalChannelFeatures GetChannelFeatures(); /// /// Determines whether [is enabled for] [the specified user]. diff --git a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs new file mode 100644 index 000000000..57a1a5129 --- /dev/null +++ b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs @@ -0,0 +1,50 @@ +using MediaBrowser.Model.Channels; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Channels +{ + public class InternalChannelFeatures + { + /// + /// Gets or sets a value indicating whether this instance can search. + /// + /// true if this instance can search; otherwise, false. + public bool CanSearch { get; set; } + + /// + /// Gets or sets the media types. + /// + /// The media types. + public List MediaTypes { get; set; } + + /// + /// Gets or sets the content types. + /// + /// The content types. + public List ContentTypes { get; set; } + + /// + /// Represents the maximum number of records the channel allows retrieving at a time + /// + 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; } + + public InternalChannelFeatures() + { + MediaTypes = new List(); + ContentTypes = new List(); + + DefaultSortFields = new List(); + } + } +} diff --git a/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs b/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs index 4f032fe91..1b05e60b6 100644 --- a/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs +++ b/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs @@ -1,4 +1,5 @@ using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Channels; namespace MediaBrowser.Controller.Channels { @@ -11,15 +12,9 @@ namespace MediaBrowser.Controller.Channels public int? StartIndex { get; set; } public int? Limit { get; set; } + + public ChannelItemSortField? SortBy { get; set; } + + public bool SortDescending { get; set; } } - - public class InternalAllChannelItemsQuery - { - public User User { get; set; } - - public int? StartIndex { get; set; } - - public int? Limit { get; set; } - } - } \ No newline at end of file diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index a198f1091..435eb9c0c 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -82,6 +82,7 @@ + diff --git a/MediaBrowser.Model/Channels/ChannelFeatures.cs b/MediaBrowser.Model/Channels/ChannelFeatures.cs index d3af8dadf..cec40d7f2 100644 --- a/MediaBrowser.Model/Channels/ChannelFeatures.cs +++ b/MediaBrowser.Model/Channels/ChannelFeatures.cs @@ -39,10 +39,10 @@ namespace MediaBrowser.Model.Channels public bool SupportsSortOrderToggle { get; set; } /// - /// Gets or sets a value indicating whether the channel content is just a single media list. + /// Gets or sets a value indicating whether this instance can filter. /// - /// true if this instance is single media list; otherwise, false. - public bool IsSingleMediaList { get; set; } + /// true if this instance can filter; otherwise, false. + public bool CanFilter { get; set; } public ChannelFeatures() { @@ -57,9 +57,10 @@ namespace MediaBrowser.Model.Channels { Name = 0, CommunityRating = 1, - ReleaseDate = 2, - Runtime = 3, - CommunityMostWatched = 4, - UserPlayCount = 5 + ContentReleaseDate = 2, + DateAdded = 3, + Runtime = 4, + CommunityMostWatched = 5, + UserPlayCount = 6 } } diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index 572db8332..acfc5228e 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -243,7 +243,21 @@ namespace MediaBrowser.Server.Implementations.Channels var channelProvider = GetChannelProvider(channel); - return channelProvider.GetChannelFeatures(); + return GetChannelFeaturesDto(channelProvider.GetChannelFeatures()); + } + + public ChannelFeatures GetChannelFeaturesDto(InternalChannelFeatures features) + { + return new ChannelFeatures + { + CanFilter = !features.MaxPageSize.HasValue, + CanSearch = features.CanSearch, + ContentTypes = features.ContentTypes, + DefaultSortFields = features.DefaultSortFields, + MaxPageSize = features.MaxPageSize, + MediaTypes = features.MediaTypes, + SupportsSortOrderToggle = features.SupportsSortOrderToggle + }; } private Guid GetInternalChannelId(string name) diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 700b2a692..6a0155ea3 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -787,5 +787,7 @@ "HeaderMetadataManager": "Metadata Manager", "HeaderPreferences": "Preferences", "MessageLoadingChannels": "Loading channel content...", - "ButtonMarkRead": "Mark Read" + "ButtonMarkRead": "Mark Read", + "OptionDefaultSort": "Default", + "OptionCommunityMostWatchedSort": "Most Watched" } \ No newline at end of file diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index faa86f775..e401d699d 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.382 + 3.0.384 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 cb59c7afa..4ea543d85 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.382 + 3.0.384 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index bfb9a547a..60ed34067 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.382 + 3.0.384 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 - +