LiveTvChannel.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Model.Configuration;
  3. using MediaBrowser.Model.LiveTv;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. namespace MediaBrowser.Controller.LiveTv
  7. {
  8. public class LiveTvChannel : BaseItem, IItemByName
  9. {
  10. /// <summary>
  11. /// Gets the user data key.
  12. /// </summary>
  13. /// <returns>System.String.</returns>
  14. public override string GetUserDataKey()
  15. {
  16. return GetClientTypeName() + "-" + Name;
  17. }
  18. /// <summary>
  19. /// Returns the folder containing the item.
  20. /// If the item is a folder, it returns the folder itself
  21. /// </summary>
  22. /// <value>The containing folder path.</value>
  23. public override string ContainingFolderPath
  24. {
  25. get
  26. {
  27. return Path;
  28. }
  29. }
  30. protected override bool GetBlockUnratedValue(UserConfiguration config)
  31. {
  32. return config.BlockUnratedItems.Contains(UnratedItem.LiveTvChannel);
  33. }
  34. /// <summary>
  35. /// Gets a value indicating whether this instance is owned item.
  36. /// </summary>
  37. /// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
  38. public override bool IsOwnedItem
  39. {
  40. get
  41. {
  42. return false;
  43. }
  44. }
  45. /// <summary>
  46. /// Gets or sets the number.
  47. /// </summary>
  48. /// <value>The number.</value>
  49. public string Number { get; set; }
  50. /// <summary>
  51. /// Gets or sets the external identifier.
  52. /// </summary>
  53. /// <value>The external identifier.</value>
  54. public string ExternalId { get; set; }
  55. /// <summary>
  56. /// Gets or sets the type of the channel.
  57. /// </summary>
  58. /// <value>The type of the channel.</value>
  59. public ChannelType ChannelType { get; set; }
  60. public string ServiceName { get; set; }
  61. /// <summary>
  62. /// Supply the image path if it can be accessed directly from the file system
  63. /// </summary>
  64. /// <value>The image path.</value>
  65. public string ProviderImagePath { get; set; }
  66. /// <summary>
  67. /// Supply the image url if it can be downloaded
  68. /// </summary>
  69. /// <value>The image URL.</value>
  70. public string ProviderImageUrl { get; set; }
  71. /// <summary>
  72. /// Gets or sets a value indicating whether this instance has image.
  73. /// </summary>
  74. /// <value><c>null</c> if [has image] contains no value, <c>true</c> if [has image]; otherwise, <c>false</c>.</value>
  75. public bool? HasProviderImage { get; set; }
  76. protected override string CreateSortName()
  77. {
  78. double number = 0;
  79. if (!string.IsNullOrEmpty(Number))
  80. {
  81. double.TryParse(Number, out number);
  82. }
  83. return number.ToString("000-") + (Name ?? string.Empty);
  84. }
  85. public override string MediaType
  86. {
  87. get
  88. {
  89. return ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video;
  90. }
  91. }
  92. public override string GetClientTypeName()
  93. {
  94. return "Channel";
  95. }
  96. public IEnumerable<BaseItem> GetTaggedItems(IEnumerable<BaseItem> inputItems)
  97. {
  98. return new List<BaseItem>();
  99. }
  100. }
  101. }