diff options
Diffstat (limited to 'MediaBrowser.Controller/Channels/ChannelVideoItem.cs')
| -rw-r--r-- | MediaBrowser.Controller/Channels/ChannelVideoItem.cs | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs index 10e486e71..f0eafcbdf 100644 --- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs @@ -1,4 +1,5 @@ using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Channels; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; @@ -6,14 +7,17 @@ using MediaBrowser.Model.Entities; using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Threading; +using MediaBrowser.Model.Users; namespace MediaBrowser.Controller.Channels { - public class ChannelVideoItem : Video, IChannelMediaItem + public class ChannelVideoItem : Video, IChannelMediaItem, IHasLookupInfo<ChannelItemLookupInfo> { public string ExternalId { get; set; } public string ChannelId { get; set; } + public string DataVersion { get; set; } public ChannelItemType ChannelItemType { get; set; } @@ -27,13 +31,13 @@ namespace MediaBrowser.Controller.Channels public override string GetUserDataKey() { - if (ContentType == ChannelMediaContentType.Trailer) + if (ContentType == ChannelMediaContentType.MovieExtra) { - var key = this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tvcom); + var key = this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tmdb); if (!string.IsNullOrWhiteSpace(key)) { - key = key + "-trailer"; + key = key + "-" + ExtraType.ToString().ToLower(); // Make sure different trailers have their own data. if (RunTimeTicks.HasValue) @@ -48,7 +52,7 @@ namespace MediaBrowser.Controller.Channels return ExternalId; } - protected override bool GetBlockUnratedValue(UserConfiguration config) + protected override bool GetBlockUnratedValue(UserPolicy config) { return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent); } @@ -61,6 +65,11 @@ namespace MediaBrowser.Controller.Channels } } + public override bool IsSaveLocalMetadataEnabled() + { + return false; + } + public ChannelVideoItem() { ChannelMediaSources = new List<ChannelMediaInfo>(); @@ -83,9 +92,32 @@ namespace MediaBrowser.Controller.Channels { var list = base.GetMediaSources(enablePathSubstitution).ToList(); - list.InsertRange(0, ChannelManager.GetCachedChannelItemMediaSources(Id.ToString("N"))); + var sources = ChannelManager.GetChannelItemMediaSources(Id.ToString("N"), false, CancellationToken.None) + .Result.ToList(); + + if (sources.Count > 0) + { + return sources; + } + + list.InsertRange(0, sources); return list; } + + public ChannelItemLookupInfo GetLookupInfo() + { + var info = GetItemLookupInfo<ChannelItemLookupInfo>(); + + info.ContentType = ContentType; + info.ExtraType = ExtraType; + + return info; + } + + protected override string GetInternalMetadataPath(string basePath) + { + return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N")); + } } } |
