diff options
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Channels/Channel.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Channels/ChannelAudioItem.cs | 17 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Channels/ChannelCategoryItem.cs | 15 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Channels/ChannelItemInfo.cs | 23 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Channels/ChannelVideoItem.cs | 40 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Channels/IChannel.cs | 34 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/ILibraryManager.cs | 1 |
7 files changed, 130 insertions, 12 deletions
diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs index c9a70f2bc..b894893c6 100644 --- a/MediaBrowser.Controller/Channels/Channel.cs +++ b/MediaBrowser.Controller/Channels/Channel.cs @@ -1,9 +1,21 @@ using MediaBrowser.Controller.Entities; +using System; +using System.Linq; namespace MediaBrowser.Controller.Channels { public class Channel : BaseItem { public string OriginalChannelName { get; set; } + + public override bool IsVisible(User user) + { + if (user.Configuration.BlockedChannels.Contains(Name, StringComparer.OrdinalIgnoreCase)) + { + return false; + } + + return base.IsVisible(user); + } } } diff --git a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs index 6f3398f52..a0999593f 100644 --- a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs @@ -1,4 +1,6 @@ -using MediaBrowser.Controller.Entities.Audio; +using System.Linq; +using MediaBrowser.Controller.Entities.Audio; +using MediaBrowser.Model.Configuration; namespace MediaBrowser.Controller.Channels { @@ -13,5 +15,18 @@ namespace MediaBrowser.Controller.Channels public ChannelMediaContentType ContentType { get; set; } public string OriginalImageUrl { get; set; } + + protected override bool GetBlockUnratedValue(UserConfiguration config) + { + return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent); + } + + public override bool SupportsLocalMetadata + { + get + { + return false; + } + } } } diff --git a/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs b/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs index 61b38c2b1..67f0ec65f 100644 --- a/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs @@ -1,4 +1,5 @@ using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Configuration; namespace MediaBrowser.Controller.Channels { @@ -9,5 +10,19 @@ namespace MediaBrowser.Controller.Channels public ChannelItemType ChannelItemType { get; set; } public string OriginalImageUrl { get; set; } + + protected override bool GetBlockUnratedValue(UserConfiguration config) + { + // Don't block. + return false; + } + + public override bool SupportsLocalMetadata + { + get + { + return false; + } + } } } diff --git a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs index 421d3e6f2..104204eb0 100644 --- a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs +++ b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs @@ -18,6 +18,7 @@ namespace MediaBrowser.Controller.Channels public string Overview { get; set; } public List<string> Genres { get; set; } + public List<string> Studios { get; set; } public List<PersonInfo> People { get; set; } @@ -38,9 +39,15 @@ namespace MediaBrowser.Controller.Channels public DateTime? PremiereDate { get; set; } public int? ProductionYear { get; set; } + public DateTime? DateCreated { get; set; } + + public List<ChannelMediaInfo> MediaSources { get; set; } + public ChannelItemInfo() { + MediaSources = new List<ChannelMediaInfo>(); Genres = new List<string>(); + Studios = new List<string>(); People = new List<PersonInfo>(); ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); } @@ -70,6 +77,20 @@ namespace MediaBrowser.Controller.Channels Movie = 3, - Episode = 4 + Episode = 4, + + Song = 5 + } + + public class ChannelMediaInfo + { + public string Path { get; set; } + + public Dictionary<string, string> RequiredHttpHeaders { get; set; } + + public ChannelMediaInfo() + { + RequiredHttpHeaders = new Dictionary<string, string>(); + } } } diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs index 83b85794d..0bf05f965 100644 --- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs @@ -1,4 +1,8 @@ using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; +using System.Globalization; +using System.Linq; namespace MediaBrowser.Controller.Channels { @@ -13,5 +17,41 @@ namespace MediaBrowser.Controller.Channels public ChannelMediaContentType ContentType { get; set; } public string OriginalImageUrl { get; set; } + + public override string GetUserDataKey() + { + if (ContentType == ChannelMediaContentType.Trailer) + { + var key = this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tvcom); + + if (!string.IsNullOrWhiteSpace(key)) + { + key = key + "-trailer"; + + // Make sure different trailers have their own data. + if (RunTimeTicks.HasValue) + { + key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture); + } + + return key; + } + } + + return base.GetUserDataKey(); + } + + protected override bool GetBlockUnratedValue(UserConfiguration config) + { + return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent); + } + + public override bool SupportsLocalMetadata + { + get + { + return false; + } + } } } diff --git a/MediaBrowser.Controller/Channels/IChannel.cs b/MediaBrowser.Controller/Channels/IChannel.cs index 773147a14..0c4be8630 100644 --- a/MediaBrowser.Controller/Channels/IChannel.cs +++ b/MediaBrowser.Controller/Channels/IChannel.cs @@ -17,16 +17,10 @@ namespace MediaBrowser.Controller.Channels string Name { get; } /// <summary> - /// Gets the home page URL. - /// </summary> - /// <value>The home page URL.</value> - string HomePageUrl { get; } - - /// <summary> - /// Gets the capabilities. + /// Gets the channel information. /// </summary> - /// <returns>ChannelCapabilities.</returns> - ChannelCapabilities GetCapabilities(); + /// <returns>ChannelInfo.</returns> + ChannelInfo GetChannelInfo(); /// <summary> /// Determines whether [is enabled for] [the specified user]. @@ -67,9 +61,29 @@ namespace MediaBrowser.Controller.Channels IEnumerable<ImageType> GetSupportedChannelImages(); } - public class ChannelCapabilities + public class ChannelInfo { + /// <summary> + /// Gets the home page URL. + /// </summary> + /// <value>The home page URL.</value> + public string HomePageUrl { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether this instance can search. + /// </summary> + /// <value><c>true</c> if this instance can search; otherwise, <c>false</c>.</value> public bool CanSearch { get; set; } + + public List<ChannelMediaType> MediaTypes { get; set; } + + public List<ChannelMediaContentType> ContentTypes { get; set; } + + public ChannelInfo() + { + MediaTypes = new List<ChannelMediaType>(); + ContentTypes = new List<ChannelMediaContentType>(); + } } public class ChannelSearchInfo diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 9e18dc9b0..7529f1e0d 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Model.Querying; namespace MediaBrowser.Controller.Library { |
