LiveTvChannel.cs 3.6 KB

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