LiveTvChannel.cs 3.4 KB

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