ChannelVideoItem.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Model.Channels;
  3. using MediaBrowser.Model.Configuration;
  4. using MediaBrowser.Model.Entities;
  5. using System.Collections.Generic;
  6. using System.Globalization;
  7. using System.Linq;
  8. namespace MediaBrowser.Controller.Channels
  9. {
  10. public class ChannelVideoItem : Video, IChannelMediaItem
  11. {
  12. public string ExternalId { get; set; }
  13. public string ChannelId { get; set; }
  14. public ChannelItemType ChannelItemType { get; set; }
  15. public bool IsInfiniteStream { get; set; }
  16. public ChannelMediaContentType ContentType { get; set; }
  17. public string OriginalImageUrl { get; set; }
  18. public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
  19. public override string GetUserDataKey()
  20. {
  21. if (ContentType == ChannelMediaContentType.Trailer)
  22. {
  23. var key = this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tvcom);
  24. if (!string.IsNullOrWhiteSpace(key))
  25. {
  26. key = key + "-trailer";
  27. // Make sure different trailers have their own data.
  28. if (RunTimeTicks.HasValue)
  29. {
  30. key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture);
  31. }
  32. return key;
  33. }
  34. }
  35. return base.GetUserDataKey();
  36. }
  37. protected override bool GetBlockUnratedValue(UserConfiguration config)
  38. {
  39. return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent);
  40. }
  41. public override bool SupportsLocalMetadata
  42. {
  43. get
  44. {
  45. return false;
  46. }
  47. }
  48. public ChannelVideoItem()
  49. {
  50. ChannelMediaSources = new List<ChannelMediaInfo>();
  51. }
  52. public override LocationType LocationType
  53. {
  54. get
  55. {
  56. if (string.IsNullOrEmpty(Path))
  57. {
  58. return LocationType.Remote;
  59. }
  60. return base.LocationType;
  61. }
  62. }
  63. }
  64. }