ChannelVideoItem.cs 2.3 KB

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