ILiveTvService.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading;
  4. using System.Threading.Tasks;
  5. namespace MediaBrowser.Controller.LiveTv
  6. {
  7. /// <summary>
  8. /// Represents a single live tv back end (next pvr, media portal, etc).
  9. /// </summary>
  10. public interface ILiveTvService
  11. {
  12. /// <summary>
  13. /// Gets the name.
  14. /// </summary>
  15. /// <value>The name.</value>
  16. string Name { get; }
  17. /// <summary>
  18. /// Gets the channels async.
  19. /// </summary>
  20. /// <param name="cancellationToken">The cancellation token.</param>
  21. /// <returns>Task{IEnumerable{ChannelInfo}}.</returns>
  22. Task<IEnumerable<ChannelInfo>> GetChannelsAsync(CancellationToken cancellationToken);
  23. /// <summary>
  24. /// Cancels the timer asynchronous.
  25. /// </summary>
  26. /// <param name="timerId">The timer identifier.</param>
  27. /// <param name="cancellationToken">The cancellation token.</param>
  28. /// <returns>Task.</returns>
  29. Task CancelTimerAsync(string timerId, CancellationToken cancellationToken);
  30. /// <summary>
  31. /// Cancels the series timer asynchronous.
  32. /// </summary>
  33. /// <param name="timerId">The timer identifier.</param>
  34. /// <param name="cancellationToken">The cancellation token.</param>
  35. /// <returns>Task.</returns>
  36. Task CancelSeriesTimerAsync(string timerId, CancellationToken cancellationToken);
  37. /// <summary>
  38. /// Deletes the recording asynchronous.
  39. /// </summary>
  40. /// <param name="recordingId">The recording identifier.</param>
  41. /// <param name="cancellationToken">The cancellation token.</param>
  42. /// <returns>Task.</returns>
  43. Task DeleteRecordingAsync(string recordingId, CancellationToken cancellationToken);
  44. /// <summary>
  45. /// Creates the timer asynchronous.
  46. /// </summary>
  47. /// <param name="info">The information.</param>
  48. /// <param name="cancellationToken">The cancellation token.</param>
  49. /// <returns>Task.</returns>
  50. Task CreateTimerAsync(TimerInfo info, CancellationToken cancellationToken);
  51. /// <summary>
  52. /// Creates the series timer asynchronous.
  53. /// </summary>
  54. /// <param name="info">The information.</param>
  55. /// <param name="cancellationToken">The cancellation token.</param>
  56. /// <returns>Task.</returns>
  57. Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken);
  58. /// <summary>
  59. /// Updates the timer asynchronous.
  60. /// </summary>
  61. /// <param name="info">The information.</param>
  62. /// <param name="cancellationToken">The cancellation token.</param>
  63. /// <returns>Task.</returns>
  64. Task UpdateTimerAsync(TimerInfo info, CancellationToken cancellationToken);
  65. /// <summary>
  66. /// Updates the series timer asynchronous.
  67. /// </summary>
  68. /// <param name="info">The information.</param>
  69. /// <param name="cancellationToken">The cancellation token.</param>
  70. /// <returns>Task.</returns>
  71. Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken);
  72. /// <summary>
  73. /// Gets the channel image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to ChannelInfo
  74. /// </summary>
  75. /// <param name="channelId">The channel identifier.</param>
  76. /// <param name="cancellationToken">The cancellation token.</param>
  77. /// <returns>Task{Stream}.</returns>
  78. Task<StreamResponseInfo> GetChannelImageAsync(string channelId, CancellationToken cancellationToken);
  79. /// <summary>
  80. /// Gets the recording image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to RecordingInfo
  81. /// </summary>
  82. /// <param name="recordingId">The recording identifier.</param>
  83. /// <param name="cancellationToken">The cancellation token.</param>
  84. /// <returns>Task{ImageResponseInfo}.</returns>
  85. Task<StreamResponseInfo> GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken);
  86. /// <summary>
  87. /// Gets the program image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to ProgramInfo
  88. /// </summary>
  89. /// <param name="programId">The program identifier.</param>
  90. /// <param name="channelId">The channel identifier.</param>
  91. /// <param name="cancellationToken">The cancellation token.</param>
  92. /// <returns>Task{ImageResponseInfo}.</returns>
  93. Task<StreamResponseInfo> GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken);
  94. /// <summary>
  95. /// Gets the recordings asynchronous.
  96. /// </summary>
  97. /// <param name="cancellationToken">The cancellation token.</param>
  98. /// <returns>Task{IEnumerable{RecordingInfo}}.</returns>
  99. Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken);
  100. /// <summary>
  101. /// Gets the recordings asynchronous.
  102. /// </summary>
  103. /// <param name="cancellationToken">The cancellation token.</param>
  104. /// <returns>Task{IEnumerable{RecordingInfo}}.</returns>
  105. Task<IEnumerable<TimerInfo>> GetTimersAsync(CancellationToken cancellationToken);
  106. /// <summary>
  107. /// Gets the timer defaults asynchronous.
  108. /// </summary>
  109. /// <param name="cancellationToken">The cancellation token.</param>
  110. /// <returns>Task{TimerInfo}.</returns>
  111. Task<SeriesTimerInfo> GetNewTimerDefaultsAsync(CancellationToken cancellationToken);
  112. /// <summary>
  113. /// Gets the series timers asynchronous.
  114. /// </summary>
  115. /// <param name="cancellationToken">The cancellation token.</param>
  116. /// <returns>Task{IEnumerable{SeriesTimerInfo}}.</returns>
  117. Task<IEnumerable<SeriesTimerInfo>> GetSeriesTimersAsync(CancellationToken cancellationToken);
  118. /// <summary>
  119. /// Gets the programs asynchronous.
  120. /// </summary>
  121. /// <param name="channelId">The channel identifier.</param>
  122. /// <param name="startDateUtc">The start date UTC.</param>
  123. /// <param name="endDateUtc">The end date UTC.</param>
  124. /// <param name="cancellationToken">The cancellation token.</param>
  125. /// <returns>Task{IEnumerable{ProgramInfo}}.</returns>
  126. Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken);
  127. /// <summary>
  128. /// Gets the recording stream.
  129. /// </summary>
  130. /// <param name="recordingId">The recording identifier.</param>
  131. /// <param name="cancellationToken">The cancellation token.</param>
  132. /// <returns>Task{Stream}.</returns>
  133. Task<LiveStreamInfo> GetRecordingStream(string recordingId, CancellationToken cancellationToken);
  134. /// <summary>
  135. /// Gets the channel stream.
  136. /// </summary>
  137. /// <param name="channelId">The channel identifier.</param>
  138. /// <param name="cancellationToken">The cancellation token.</param>
  139. /// <returns>Task{Stream}.</returns>
  140. Task<LiveStreamInfo> GetChannelStream(string channelId, CancellationToken cancellationToken);
  141. /// <summary>
  142. /// Closes the live stream.
  143. /// </summary>
  144. /// <param name="id">The identifier.</param>
  145. /// <param name="cancellationToken">The cancellation token.</param>
  146. /// <returns>Task.</returns>
  147. Task CloseLiveStream(string id, CancellationToken cancellationToken);
  148. /// <summary>
  149. /// Records the live stream.
  150. /// </summary>
  151. /// <param name="id">The identifier.</param>
  152. /// <param name="cancellationToken">The cancellation token.</param>
  153. /// <returns>Task.</returns>
  154. Task RecordLiveStream(string id, CancellationToken cancellationToken);
  155. }
  156. }