ILiveTvManager.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. using MediaBrowser.Controller.Channels;
  2. using MediaBrowser.Controller.Dto;
  3. using MediaBrowser.Controller.Entities;
  4. using MediaBrowser.Model.Dto;
  5. using MediaBrowser.Model.Entities;
  6. using MediaBrowser.Model.LiveTv;
  7. using MediaBrowser.Model.Querying;
  8. using System.Collections.Generic;
  9. using System.Threading;
  10. using System.Threading.Tasks;
  11. namespace MediaBrowser.Controller.LiveTv
  12. {
  13. /// <summary>
  14. /// Manages all live tv services installed on the server
  15. /// </summary>
  16. public interface ILiveTvManager
  17. {
  18. /// <summary>
  19. /// Gets the services.
  20. /// </summary>
  21. /// <value>The services.</value>
  22. IReadOnlyList<ILiveTvService> Services { get; }
  23. /// <summary>
  24. /// Gets the new timer defaults asynchronous.
  25. /// </summary>
  26. /// <param name="cancellationToken">The cancellation token.</param>
  27. /// <returns>Task{TimerInfo}.</returns>
  28. Task<SeriesTimerInfoDto> GetNewTimerDefaults(CancellationToken cancellationToken);
  29. /// <summary>
  30. /// Gets the new timer defaults.
  31. /// </summary>
  32. /// <param name="programId">The program identifier.</param>
  33. /// <param name="cancellationToken">The cancellation token.</param>
  34. /// <returns>Task{SeriesTimerInfoDto}.</returns>
  35. Task<SeriesTimerInfoDto> GetNewTimerDefaults(string programId, CancellationToken cancellationToken);
  36. /// <summary>
  37. /// Deletes the recording.
  38. /// </summary>
  39. /// <param name="id">The identifier.</param>
  40. /// <returns>Task.</returns>
  41. Task DeleteRecording(string id);
  42. /// <summary>
  43. /// Deletes the recording.
  44. /// </summary>
  45. /// <param name="recording">The recording.</param>
  46. /// <returns>Task.</returns>
  47. Task DeleteRecording(ILiveTvRecording recording);
  48. /// <summary>
  49. /// Cancels the timer.
  50. /// </summary>
  51. /// <param name="id">The identifier.</param>
  52. /// <returns>Task.</returns>
  53. Task CancelTimer(string id);
  54. /// <summary>
  55. /// Cancels the series timer.
  56. /// </summary>
  57. /// <param name="id">The identifier.</param>
  58. /// <returns>Task.</returns>
  59. Task CancelSeriesTimer(string id);
  60. /// <summary>
  61. /// Adds the parts.
  62. /// </summary>
  63. /// <param name="services">The services.</param>
  64. /// <param name="tunerHosts">The tuner hosts.</param>
  65. /// <param name="listingProviders">The listing providers.</param>
  66. void AddParts(IEnumerable<ILiveTvService> services, IEnumerable<ITunerHost> tunerHosts, IEnumerable<IListingsProvider> listingProviders);
  67. /// <summary>
  68. /// Gets the channels.
  69. /// </summary>
  70. /// <param name="query">The query.</param>
  71. /// <param name="options">The options.</param>
  72. /// <param name="cancellationToken">The cancellation token.</param>
  73. /// <returns>IEnumerable{Channel}.</returns>
  74. Task<QueryResult<ChannelInfoDto>> GetChannels(LiveTvChannelQuery query, DtoOptions options, CancellationToken cancellationToken);
  75. /// <summary>
  76. /// Gets the recording.
  77. /// </summary>
  78. /// <param name="id">The identifier.</param>
  79. /// <param name="options">The options.</param>
  80. /// <param name="cancellationToken">The cancellation token.</param>
  81. /// <param name="user">The user.</param>
  82. /// <returns>Task{RecordingInfoDto}.</returns>
  83. Task<BaseItemDto> GetRecording(string id, DtoOptions options, CancellationToken cancellationToken, User user = null);
  84. /// <summary>
  85. /// Gets the channel.
  86. /// </summary>
  87. /// <param name="id">The identifier.</param>
  88. /// <param name="cancellationToken">The cancellation token.</param>
  89. /// <param name="user">The user.</param>
  90. /// <returns>Task{RecordingInfoDto}.</returns>
  91. Task<ChannelInfoDto> GetChannel(string id, CancellationToken cancellationToken, User user = null);
  92. /// <summary>
  93. /// Gets the timer.
  94. /// </summary>
  95. /// <param name="id">The identifier.</param>
  96. /// <param name="cancellationToken">The cancellation token.</param>
  97. /// <returns>Task{TimerInfoDto}.</returns>
  98. Task<TimerInfoDto> GetTimer(string id, CancellationToken cancellationToken);
  99. /// <summary>
  100. /// Gets the series timer.
  101. /// </summary>
  102. /// <param name="id">The identifier.</param>
  103. /// <param name="cancellationToken">The cancellation token.</param>
  104. /// <returns>Task{TimerInfoDto}.</returns>
  105. Task<SeriesTimerInfoDto> GetSeriesTimer(string id, CancellationToken cancellationToken);
  106. /// <summary>
  107. /// Gets the recordings.
  108. /// </summary>
  109. /// <param name="query">The query.</param>
  110. /// <param name="options">The options.</param>
  111. /// <param name="cancellationToken">The cancellation token.</param>
  112. /// <returns>QueryResult{RecordingInfoDto}.</returns>
  113. Task<QueryResult<BaseItemDto>> GetRecordings(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken);
  114. /// <summary>
  115. /// Gets the timers.
  116. /// </summary>
  117. /// <param name="query">The query.</param>
  118. /// <param name="cancellationToken">The cancellation token.</param>
  119. /// <returns>Task{QueryResult{TimerInfoDto}}.</returns>
  120. Task<QueryResult<TimerInfoDto>> GetTimers(TimerQuery query, CancellationToken cancellationToken);
  121. /// <summary>
  122. /// Gets the series timers.
  123. /// </summary>
  124. /// <param name="query">The query.</param>
  125. /// <param name="cancellationToken">The cancellation token.</param>
  126. /// <returns>Task{QueryResult{SeriesTimerInfoDto}}.</returns>
  127. Task<QueryResult<SeriesTimerInfoDto>> GetSeriesTimers(SeriesTimerQuery query, CancellationToken cancellationToken);
  128. /// <summary>
  129. /// Gets the channel.
  130. /// </summary>
  131. /// <param name="id">The identifier.</param>
  132. /// <returns>Channel.</returns>
  133. LiveTvChannel GetInternalChannel(string id);
  134. /// <summary>
  135. /// Gets the recording.
  136. /// </summary>
  137. /// <param name="id">The identifier.</param>
  138. /// <param name="cancellationToken">The cancellation token.</param>
  139. /// <returns>LiveTvRecording.</returns>
  140. Task<ILiveTvRecording> GetInternalRecording(string id, CancellationToken cancellationToken);
  141. /// <summary>
  142. /// Gets the recording stream.
  143. /// </summary>
  144. /// <param name="id">The identifier.</param>
  145. /// <param name="cancellationToken">The cancellation token.</param>
  146. /// <returns>Task{Stream}.</returns>
  147. Task<MediaSourceInfo> GetRecordingStream(string id, CancellationToken cancellationToken);
  148. /// <summary>
  149. /// Gets the channel stream.
  150. /// </summary>
  151. /// <param name="id">The identifier.</param>
  152. /// <param name="mediaSourceId">The media source identifier.</param>
  153. /// <param name="cancellationToken">The cancellation token.</param>
  154. /// <returns>Task{StreamResponseInfo}.</returns>
  155. Task<MediaSourceInfo> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken);
  156. /// <summary>
  157. /// Gets the program.
  158. /// </summary>
  159. /// <param name="id">The identifier.</param>
  160. /// <param name="cancellationToken">The cancellation token.</param>
  161. /// <param name="user">The user.</param>
  162. /// <returns>Task{ProgramInfoDto}.</returns>
  163. Task<BaseItemDto> GetProgram(string id, CancellationToken cancellationToken, User user = null);
  164. /// <summary>
  165. /// Gets the programs.
  166. /// </summary>
  167. /// <param name="query">The query.</param>
  168. /// <param name="options">The options.</param>
  169. /// <param name="cancellationToken">The cancellation token.</param>
  170. /// <returns>IEnumerable{ProgramInfo}.</returns>
  171. Task<QueryResult<BaseItemDto>> GetPrograms(ProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
  172. /// <summary>
  173. /// Updates the timer.
  174. /// </summary>
  175. /// <param name="timer">The timer.</param>
  176. /// <param name="cancellationToken">The cancellation token.</param>
  177. /// <returns>Task.</returns>
  178. Task UpdateTimer(TimerInfoDto timer, CancellationToken cancellationToken);
  179. /// <summary>
  180. /// Updates the timer.
  181. /// </summary>
  182. /// <param name="timer">The timer.</param>
  183. /// <param name="cancellationToken">The cancellation token.</param>
  184. /// <returns>Task.</returns>
  185. Task UpdateSeriesTimer(SeriesTimerInfoDto timer, CancellationToken cancellationToken);
  186. /// <summary>
  187. /// Creates the timer.
  188. /// </summary>
  189. /// <param name="timer">The timer.</param>
  190. /// <param name="cancellationToken">The cancellation token.</param>
  191. /// <returns>Task.</returns>
  192. Task CreateTimer(TimerInfoDto timer, CancellationToken cancellationToken);
  193. /// <summary>
  194. /// Creates the series timer.
  195. /// </summary>
  196. /// <param name="timer">The timer.</param>
  197. /// <param name="cancellationToken">The cancellation token.</param>
  198. /// <returns>Task.</returns>
  199. Task CreateSeriesTimer(SeriesTimerInfoDto timer, CancellationToken cancellationToken);
  200. /// <summary>
  201. /// Gets the recording groups.
  202. /// </summary>
  203. /// <param name="query">The query.</param>
  204. /// <param name="cancellationToken">The cancellation token.</param>
  205. /// <returns>Task{QueryResult{RecordingGroupDto}}.</returns>
  206. Task<QueryResult<BaseItemDto>> GetRecordingGroups(RecordingGroupQuery query, CancellationToken cancellationToken);
  207. /// <summary>
  208. /// Closes the live stream.
  209. /// </summary>
  210. /// <param name="id">The identifier.</param>
  211. /// <param name="cancellationToken">The cancellation token.</param>
  212. /// <returns>Task.</returns>
  213. Task CloseLiveStream(string id, CancellationToken cancellationToken);
  214. /// <summary>
  215. /// Gets the guide information.
  216. /// </summary>
  217. /// <returns>GuideInfo.</returns>
  218. GuideInfo GetGuideInfo();
  219. /// <summary>
  220. /// Gets the recommended programs.
  221. /// </summary>
  222. /// <param name="query">The query.</param>
  223. /// <param name="options">The options.</param>
  224. /// <param name="cancellationToken">The cancellation token.</param>
  225. /// <returns>Task{QueryResult{ProgramInfoDto}}.</returns>
  226. Task<QueryResult<BaseItemDto>> GetRecommendedPrograms(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
  227. /// <summary>
  228. /// Gets the recommended programs internal.
  229. /// </summary>
  230. /// <param name="query">The query.</param>
  231. /// <param name="cancellationToken">The cancellation token.</param>
  232. /// <returns>Task&lt;QueryResult&lt;LiveTvProgram&gt;&gt;.</returns>
  233. Task<QueryResult<LiveTvProgram>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, CancellationToken cancellationToken);
  234. /// <summary>
  235. /// Gets the live tv information.
  236. /// </summary>
  237. /// <param name="cancellationToken">The cancellation token.</param>
  238. /// <returns>Task{LiveTvInfo}.</returns>
  239. Task<LiveTvInfo> GetLiveTvInfo(CancellationToken cancellationToken);
  240. /// <summary>
  241. /// Resets the tuner.
  242. /// </summary>
  243. /// <param name="id">The identifier.</param>
  244. /// <param name="cancellationToken">The cancellation token.</param>
  245. /// <returns>Task.</returns>
  246. Task ResetTuner(string id, CancellationToken cancellationToken);
  247. /// <summary>
  248. /// Gets the live tv folder.
  249. /// </summary>
  250. /// <param name="cancellationToken">The cancellation token.</param>
  251. /// <returns>BaseItemDto.</returns>
  252. Task<Folder> GetInternalLiveTvFolder(CancellationToken cancellationToken);
  253. /// <summary>
  254. /// Gets the live tv folder.
  255. /// </summary>
  256. /// <param name="userId">The user identifier.</param>
  257. /// <param name="cancellationToken">The cancellation token.</param>
  258. /// <returns>BaseItemDto.</returns>
  259. Task<BaseItemDto> GetLiveTvFolder(string userId, CancellationToken cancellationToken);
  260. /// <summary>
  261. /// Gets the enabled users.
  262. /// </summary>
  263. /// <returns>IEnumerable{User}.</returns>
  264. IEnumerable<User> GetEnabledUsers();
  265. /// <summary>
  266. /// Gets the internal channels.
  267. /// </summary>
  268. /// <param name="query">The query.</param>
  269. /// <param name="cancellationToken">The cancellation token.</param>
  270. /// <returns>Task&lt;QueryResult&lt;LiveTvChannel&gt;&gt;.</returns>
  271. Task<QueryResult<LiveTvChannel>> GetInternalChannels(LiveTvChannelQuery query,
  272. CancellationToken cancellationToken);
  273. /// <summary>
  274. /// Gets the internal recordings.
  275. /// </summary>
  276. /// <param name="query">The query.</param>
  277. /// <param name="cancellationToken">The cancellation token.</param>
  278. /// <returns>Task&lt;QueryResult&lt;BaseItem&gt;&gt;.</returns>
  279. Task<QueryResult<BaseItem>> GetInternalRecordings(RecordingQuery query, CancellationToken cancellationToken);
  280. /// <summary>
  281. /// Gets the recording media sources.
  282. /// </summary>
  283. /// <param name="id">The identifier.</param>
  284. /// <param name="cancellationToken">The cancellation token.</param>
  285. /// <returns>Task&lt;IEnumerable&lt;MediaSourceInfo&gt;&gt;.</returns>
  286. Task<IEnumerable<MediaSourceInfo>> GetRecordingMediaSources(string id, CancellationToken cancellationToken);
  287. /// <summary>
  288. /// Gets the channel media sources.
  289. /// </summary>
  290. /// <param name="id">The identifier.</param>
  291. /// <param name="cancellationToken">The cancellation token.</param>
  292. /// <returns>Task&lt;IEnumerable&lt;MediaSourceInfo&gt;&gt;.</returns>
  293. Task<IEnumerable<MediaSourceInfo>> GetChannelMediaSources(string id, CancellationToken cancellationToken);
  294. /// <summary>
  295. /// Adds the information to recording dto.
  296. /// </summary>
  297. /// <param name="item">The item.</param>
  298. /// <param name="dto">The dto.</param>
  299. /// <param name="user">The user.</param>
  300. void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, User user = null);
  301. /// <summary>
  302. /// Adds the information to program dto.
  303. /// </summary>
  304. /// <param name="item">The item.</param>
  305. /// <param name="dto">The dto.</param>
  306. /// <param name="addChannelInfo">if set to <c>true</c> [add channel information].</param>
  307. /// <param name="user">The user.</param>
  308. void AddInfoToProgramDto(BaseItem item, BaseItemDto dto, bool addChannelInfo, User user = null);
  309. /// <summary>
  310. /// Saves the tuner host.
  311. /// </summary>
  312. /// <param name="info">The information.</param>
  313. /// <returns>Task.</returns>
  314. Task<TunerHostInfo> SaveTunerHost(TunerHostInfo info);
  315. /// <summary>
  316. /// Saves the listing provider.
  317. /// </summary>
  318. /// <param name="info">The information.</param>
  319. /// <param name="validateLogin">if set to <c>true</c> [validate login].</param>
  320. /// <param name="validateListings">if set to <c>true</c> [validate listings].</param>
  321. /// <returns>Task.</returns>
  322. Task<ListingsProviderInfo> SaveListingProvider(ListingsProviderInfo info, bool validateLogin, bool validateListings);
  323. /// <summary>
  324. /// Gets the lineups.
  325. /// </summary>
  326. /// <param name="providerType">Type of the provider.</param>
  327. /// <param name="providerId">The provider identifier.</param>
  328. /// <param name="country">The country.</param>
  329. /// <param name="location">The location.</param>
  330. /// <returns>Task&lt;List&lt;NameIdPair&gt;&gt;.</returns>
  331. Task<List<NameIdPair>> GetLineups(string providerType, string providerId, string country, string location);
  332. /// <summary>
  333. /// Gets the registration information.
  334. /// </summary>
  335. /// <param name="channelId">The channel identifier.</param>
  336. /// <param name="programId">The program identifier.</param>
  337. /// <param name="feature">The feature.</param>
  338. /// <returns>Task&lt;MBRegistrationRecord&gt;.</returns>
  339. Task<MBRegistrationRecord> GetRegistrationInfo(string channelId, string programId, string feature);
  340. /// <summary>
  341. /// Adds the channel information.
  342. /// </summary>
  343. /// <param name="dto">The dto.</param>
  344. /// <param name="channel">The channel.</param>
  345. /// <param name="options">The options.</param>
  346. /// <param name="user">The user.</param>
  347. void AddChannelInfo(BaseItemDto dto, LiveTvChannel channel, DtoOptions options, User user);
  348. }
  349. }