jellyfin-server/MediaBrowser.Controller/Channels/ChannelVideoItem.cs

94 lines
2.7 KiB
C#
Raw Normal View History

2014-03-18 01:45:41 +00:00
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Channels;
2014-05-03 04:20:04 +00:00
using MediaBrowser.Model.Configuration;
2014-06-03 02:01:30 +00:00
using MediaBrowser.Model.Dto;
2014-05-03 04:20:04 +00:00
using MediaBrowser.Model.Entities;
2014-05-18 19:58:42 +00:00
using System.Collections.Generic;
2014-05-03 04:20:04 +00:00
using System.Globalization;
using System.Linq;
2014-03-18 01:45:41 +00:00
namespace MediaBrowser.Controller.Channels
{
2014-03-19 01:35:40 +00:00
public class ChannelVideoItem : Video, IChannelMediaItem
2014-03-18 01:45:41 +00:00
{
2014-06-03 02:01:30 +00:00
public static IChannelManager ChannelManager { get; set; }
2014-03-18 01:45:41 +00:00
public string ExternalId { get; set; }
2014-05-05 00:46:52 +00:00
public string ChannelId { get; set; }
2014-03-18 01:45:41 +00:00
public ChannelItemType ChannelItemType { get; set; }
public bool IsInfiniteStream { get; set; }
public ChannelMediaContentType ContentType { get; set; }
public string OriginalImageUrl { get; set; }
2014-05-03 04:20:04 +00:00
2014-05-18 19:58:42 +00:00
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
2014-05-03 04:20:04 +00:00
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;
}
}
2014-06-02 19:32:41 +00:00
return ExternalId;
2014-05-03 04:20:04 +00:00
}
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent);
}
public override bool SupportsLocalMetadata
{
get
{
return false;
}
}
2014-05-18 19:58:42 +00:00
public ChannelVideoItem()
{
ChannelMediaSources = new List<ChannelMediaInfo>();
}
public override LocationType LocationType
{
get
{
if (string.IsNullOrEmpty(Path))
{
return LocationType.Remote;
}
return base.LocationType;
}
}
2014-06-03 02:01:30 +00:00
public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
{
var list = base.GetMediaSources(enablePathSubstitution).ToList();
list.InsertRange(0, ChannelManager.GetCachedChannelItemMediaSources(Id.ToString("N")));
return list;
}
2014-03-18 01:45:41 +00:00
}
}