LiveTvProgram.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Model.LiveTv;
  3. using System;
  4. namespace MediaBrowser.Controller.LiveTv
  5. {
  6. public class LiveTvProgram : BaseItem
  7. {
  8. /// <summary>
  9. /// Gets the user data key.
  10. /// </summary>
  11. /// <returns>System.String.</returns>
  12. public override string GetUserDataKey()
  13. {
  14. return GetClientTypeName() + "-" + Name;
  15. }
  16. /// <summary>
  17. /// Id of the program.
  18. /// </summary>
  19. public string ExternalId { get; set; }
  20. /// <summary>
  21. /// Gets or sets the channel identifier.
  22. /// </summary>
  23. /// <value>The channel identifier.</value>
  24. public string ExternalChannelId { get; set; }
  25. /// <summary>
  26. /// Gets or sets the type of the channel.
  27. /// </summary>
  28. /// <value>The type of the channel.</value>
  29. public ChannelType ChannelType { get; set; }
  30. /// <summary>
  31. /// The start date of the program, in UTC.
  32. /// </summary>
  33. public DateTime StartDate { get; set; }
  34. /// <summary>
  35. /// Gets or sets a value indicating whether this instance is hd.
  36. /// </summary>
  37. /// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value>
  38. public bool? IsHD { get; set; }
  39. /// <summary>
  40. /// Gets or sets the audio.
  41. /// </summary>
  42. /// <value>The audio.</value>
  43. public ProgramAudio? Audio { get; set; }
  44. /// <summary>
  45. /// Gets or sets a value indicating whether this instance is repeat.
  46. /// </summary>
  47. /// <value><c>true</c> if this instance is repeat; otherwise, <c>false</c>.</value>
  48. public bool IsRepeat { get; set; }
  49. /// <summary>
  50. /// Gets or sets the episode title.
  51. /// </summary>
  52. /// <value>The episode title.</value>
  53. public string EpisodeTitle { get; set; }
  54. /// <summary>
  55. /// Gets or sets the name of the service.
  56. /// </summary>
  57. /// <value>The name of the service.</value>
  58. public string ServiceName { get; set; }
  59. /// <summary>
  60. /// Supply the image path if it can be accessed directly from the file system
  61. /// </summary>
  62. /// <value>The image path.</value>
  63. public string ProviderImagePath { get; set; }
  64. /// <summary>
  65. /// Supply the image url if it can be downloaded
  66. /// </summary>
  67. /// <value>The image URL.</value>
  68. public string ProviderImageUrl { get; set; }
  69. /// <summary>
  70. /// Gets or sets a value indicating whether this instance has image.
  71. /// </summary>
  72. /// <value><c>null</c> if [has image] contains no value, <c>true</c> if [has image]; otherwise, <c>false</c>.</value>
  73. public bool? HasProviderImage { get; set; }
  74. /// <summary>
  75. /// Gets or sets a value indicating whether this instance is movie.
  76. /// </summary>
  77. /// <value><c>true</c> if this instance is movie; otherwise, <c>false</c>.</value>
  78. public bool IsMovie { get; set; }
  79. /// <summary>
  80. /// Gets or sets a value indicating whether this instance is sports.
  81. /// </summary>
  82. /// <value><c>true</c> if this instance is sports; otherwise, <c>false</c>.</value>
  83. public bool IsSports { get; set; }
  84. /// <summary>
  85. /// Gets or sets a value indicating whether this instance is series.
  86. /// </summary>
  87. /// <value><c>true</c> if this instance is series; otherwise, <c>false</c>.</value>
  88. public bool IsSeries { get; set; }
  89. /// <summary>
  90. /// Gets or sets a value indicating whether this instance is live.
  91. /// </summary>
  92. /// <value><c>true</c> if this instance is live; otherwise, <c>false</c>.</value>
  93. public bool IsLive { get; set; }
  94. /// <summary>
  95. /// Gets or sets a value indicating whether this instance is news.
  96. /// </summary>
  97. /// <value><c>true</c> if this instance is news; otherwise, <c>false</c>.</value>
  98. public bool IsNews { get; set; }
  99. /// <summary>
  100. /// Gets or sets a value indicating whether this instance is kids.
  101. /// </summary>
  102. /// <value><c>true</c> if this instance is kids; otherwise, <c>false</c>.</value>
  103. public bool IsKids { get; set; }
  104. /// <summary>
  105. /// Gets or sets a value indicating whether this instance is premiere.
  106. /// </summary>
  107. /// <value><c>true</c> if this instance is premiere; otherwise, <c>false</c>.</value>
  108. public bool IsPremiere { get; set; }
  109. public override string MediaType
  110. {
  111. get
  112. {
  113. return ChannelType == ChannelType.TV ? Model.Entities.MediaType.Video : Model.Entities.MediaType.Audio;
  114. }
  115. }
  116. public bool IsAiring
  117. {
  118. get
  119. {
  120. var now = DateTime.UtcNow;
  121. return now >= StartDate && now < EndDate;
  122. }
  123. }
  124. public bool HasAired
  125. {
  126. get
  127. {
  128. var now = DateTime.UtcNow;
  129. return now >= EndDate;
  130. }
  131. }
  132. public override string GetClientTypeName()
  133. {
  134. return "Program";
  135. }
  136. }
  137. }