LiveTvService.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. using MediaBrowser.Controller.Library;
  2. using MediaBrowser.Controller.LiveTv;
  3. using MediaBrowser.Model.Entities;
  4. using MediaBrowser.Model.LiveTv;
  5. using MediaBrowser.Model.Querying;
  6. using ServiceStack;
  7. using System;
  8. using System.Globalization;
  9. using System.Linq;
  10. using System.Threading;
  11. using System.Threading.Tasks;
  12. namespace MediaBrowser.Api.LiveTv
  13. {
  14. [Route("/LiveTv/Info", "GET", Summary = "Gets available live tv services.")]
  15. public class GetLiveTvInfo : IReturn<LiveTvInfo>
  16. {
  17. }
  18. [Route("/LiveTv/Channels", "GET", Summary = "Gets available live tv channels.")]
  19. public class GetChannels : IReturn<QueryResult<ChannelInfoDto>>
  20. {
  21. [ApiMember(Name = "Type", Description = "Optional filter by channel type.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  22. public ChannelType? Type { get; set; }
  23. [ApiMember(Name = "UserId", Description = "Optional filter by user and attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  24. public string UserId { get; set; }
  25. /// <summary>
  26. /// Skips over a given number of items within the results. Use for paging.
  27. /// </summary>
  28. /// <value>The start index.</value>
  29. [ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  30. public int? StartIndex { get; set; }
  31. /// <summary>
  32. /// The maximum number of items to return
  33. /// </summary>
  34. /// <value>The limit.</value>
  35. [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  36. public int? Limit { get; set; }
  37. }
  38. [Route("/LiveTv/Channels/{Id}", "GET", Summary = "Gets a live tv channel")]
  39. public class GetChannel : IReturn<ChannelInfoDto>
  40. {
  41. /// <summary>
  42. /// Gets or sets the id.
  43. /// </summary>
  44. /// <value>The id.</value>
  45. [ApiMember(Name = "Id", Description = "Channel Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  46. public string Id { get; set; }
  47. [ApiMember(Name = "UserId", Description = "Optional attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  48. public string UserId { get; set; }
  49. }
  50. [Route("/LiveTv/Recordings", "GET", Summary = "Gets live tv recordings")]
  51. public class GetRecordings : IReturn<QueryResult<RecordingInfoDto>>
  52. {
  53. [ApiMember(Name = "ChannelId", Description = "Optional filter by channel id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  54. public string ChannelId { get; set; }
  55. [ApiMember(Name = "UserId", Description = "Optional filter by user and attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  56. public string UserId { get; set; }
  57. [ApiMember(Name = "GroupId", Description = "Optional filter by recording group.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  58. public string GroupId { get; set; }
  59. [ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  60. public int? StartIndex { get; set; }
  61. [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  62. public int? Limit { get; set; }
  63. [ApiMember(Name = "Status", Description = "Optional filter by recording status.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  64. public RecordingStatus? Status { get; set; }
  65. [ApiMember(Name = "Status", Description = "Optional filter by recordings that are in progress, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
  66. public bool? IsInProgress { get; set; }
  67. [ApiMember(Name = "SeriesTimerId", Description = "Optional filter by recordings belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  68. public string SeriesTimerId { get; set; }
  69. }
  70. [Route("/LiveTv/Recordings/Groups", "GET", Summary = "Gets live tv recording groups")]
  71. public class GetRecordingGroups : IReturn<QueryResult<RecordingGroupDto>>
  72. {
  73. [ApiMember(Name = "UserId", Description = "Optional filter by user and attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  74. public string UserId { get; set; }
  75. }
  76. [Route("/LiveTv/Recordings/{Id}", "GET", Summary = "Gets a live tv recording")]
  77. public class GetRecording : IReturn<RecordingInfoDto>
  78. {
  79. [ApiMember(Name = "Id", Description = "Recording Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  80. public string Id { get; set; }
  81. [ApiMember(Name = "UserId", Description = "Optional attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  82. public string UserId { get; set; }
  83. }
  84. [Route("/LiveTv/Tuners/{Id}/Reset", "POST", Summary = "Resets a tv tuner")]
  85. public class ResetTuner : IReturnVoid
  86. {
  87. [ApiMember(Name = "Id", Description = "Tuner Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  88. public string Id { get; set; }
  89. }
  90. [Route("/LiveTv/Timers/{Id}", "GET", Summary = "Gets a live tv timer")]
  91. public class GetTimer : IReturn<TimerInfoDto>
  92. {
  93. [ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  94. public string Id { get; set; }
  95. }
  96. [Route("/LiveTv/Timers/Defaults", "GET", Summary = "Gets default values for a new timer")]
  97. public class GetDefaultTimer : IReturn<SeriesTimerInfoDto>
  98. {
  99. [ApiMember(Name = "ProgramId", Description = "Optional, to attach default values based on a program.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  100. public string ProgramId { get; set; }
  101. }
  102. [Route("/LiveTv/Timers", "GET", Summary = "Gets live tv timers")]
  103. public class GetTimers : IReturn<QueryResult<TimerInfoDto>>
  104. {
  105. [ApiMember(Name = "ChannelId", Description = "Optional filter by channel id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  106. public string ChannelId { get; set; }
  107. [ApiMember(Name = "SeriesTimerId", Description = "Optional filter by timers belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  108. public string SeriesTimerId { get; set; }
  109. }
  110. [Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")]
  111. public class GetPrograms : IReturn<QueryResult<ProgramInfoDto>>
  112. {
  113. [ApiMember(Name = "ChannelIds", Description = "The channels to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
  114. public string ChannelIds { get; set; }
  115. [ApiMember(Name = "UserId", Description = "Optional filter by user id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
  116. public string UserId { get; set; }
  117. [ApiMember(Name = "MinStartDate", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
  118. public string MinStartDate { get; set; }
  119. [ApiMember(Name = "MaxStartDate", Description = "Optional. The maximum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
  120. public string MaxStartDate { get; set; }
  121. [ApiMember(Name = "MinEndDate", Description = "Optional. The minimum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
  122. public string MinEndDate { get; set; }
  123. [ApiMember(Name = "MaxEndDate", Description = "Optional. The maximum premiere date. Format = ISO", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
  124. public string MaxEndDate { get; set; }
  125. }
  126. [Route("/LiveTv/Programs/Recommended", "GET", Summary = "Gets available live tv epgs..")]
  127. public class GetRecommendedPrograms : IReturn<QueryResult<ProgramInfoDto>>
  128. {
  129. [ApiMember(Name = "UserId", Description = "Optional filter by user id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
  130. public string UserId { get; set; }
  131. [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
  132. public int? Limit { get; set; }
  133. [ApiMember(Name = "IsAiring", Description = "Optional. Filter by programs that are currently airing, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
  134. public bool? IsAiring { get; set; }
  135. [ApiMember(Name = "HasAired", Description = "Optional. Filter by programs that have completed airing, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
  136. public bool? HasAired { get; set; }
  137. }
  138. [Route("/LiveTv/Programs/{Id}", "GET", Summary = "Gets a live tv program")]
  139. public class GetProgram : IReturn<ProgramInfoDto>
  140. {
  141. [ApiMember(Name = "Id", Description = "Program Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  142. public string Id { get; set; }
  143. [ApiMember(Name = "UserId", Description = "Optional attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
  144. public string UserId { get; set; }
  145. }
  146. [Route("/LiveTv/Recordings/{Id}", "DELETE", Summary = "Deletes a live tv recording")]
  147. public class DeleteRecording : IReturnVoid
  148. {
  149. [ApiMember(Name = "Id", Description = "Recording Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  150. public string Id { get; set; }
  151. }
  152. [Route("/LiveTv/Timers/{Id}", "DELETE", Summary = "Cancels a live tv timer")]
  153. public class CancelTimer : IReturnVoid
  154. {
  155. [ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  156. public string Id { get; set; }
  157. }
  158. [Route("/LiveTv/Timers/{Id}", "POST", Summary = "Updates a live tv timer")]
  159. public class UpdateTimer : TimerInfoDto, IReturnVoid
  160. {
  161. }
  162. [Route("/LiveTv/Timers", "POST", Summary = "Creates a live tv timer")]
  163. public class CreateTimer : TimerInfoDto, IReturnVoid
  164. {
  165. }
  166. [Route("/LiveTv/SeriesTimers/{Id}", "GET", Summary = "Gets a live tv series timer")]
  167. public class GetSeriesTimer : IReturn<TimerInfoDto>
  168. {
  169. [ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  170. public string Id { get; set; }
  171. }
  172. [Route("/LiveTv/SeriesTimers", "GET", Summary = "Gets live tv series timers")]
  173. public class GetSeriesTimers : IReturn<QueryResult<SeriesTimerInfoDto>>
  174. {
  175. [ApiMember(Name = "SortBy", Description = "Optional. Sort by SortName or Priority", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
  176. public string SortBy { get; set; }
  177. [ApiMember(Name = "SortOrder", Description = "Optional. Sort in Ascending or Descending order", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
  178. public SortOrder SortOrder { get; set; }
  179. }
  180. [Route("/LiveTv/SeriesTimers/{Id}", "DELETE", Summary = "Cancels a live tv series timer")]
  181. public class CancelSeriesTimer : IReturnVoid
  182. {
  183. [ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  184. public string Id { get; set; }
  185. }
  186. [Route("/LiveTv/SeriesTimers/{Id}", "POST", Summary = "Updates a live tv series timer")]
  187. public class UpdateSeriesTimer : SeriesTimerInfoDto, IReturnVoid
  188. {
  189. }
  190. [Route("/LiveTv/SeriesTimers", "POST", Summary = "Creates a live tv series timer")]
  191. public class CreateSeriesTimer : SeriesTimerInfoDto, IReturnVoid
  192. {
  193. }
  194. [Route("/LiveTv/Recordings/Groups/{Id}", "GET", Summary = "Gets a recording group")]
  195. public class GetRecordingGroup : IReturn<RecordingGroupDto>
  196. {
  197. [ApiMember(Name = "Id", Description = "Recording group Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
  198. public string Id { get; set; }
  199. }
  200. [Route("/LiveTv/GuideInfo", "GET", Summary = "Gets guide info")]
  201. public class GetGuideInfo : IReturn<GuideInfo>
  202. {
  203. }
  204. public class LiveTvService : BaseApiService
  205. {
  206. private readonly ILiveTvManager _liveTvManager;
  207. private readonly IUserManager _userManager;
  208. public LiveTvService(ILiveTvManager liveTvManager, IUserManager userManager)
  209. {
  210. _liveTvManager = liveTvManager;
  211. _userManager = userManager;
  212. }
  213. private void AssertUserCanManageLiveTv()
  214. {
  215. var user = AuthorizationRequestFilterAttribute.GetCurrentUser(Request, _userManager);
  216. if (user == null)
  217. {
  218. throw new UnauthorizedAccessException("Anonymous live tv management is not allowed.");
  219. }
  220. if (!user.Configuration.EnableLiveTvManagement)
  221. {
  222. throw new UnauthorizedAccessException("The current user does not have permission to manage live tv.");
  223. }
  224. }
  225. public object Get(GetLiveTvInfo request)
  226. {
  227. var info = _liveTvManager.GetLiveTvInfo(CancellationToken.None).Result;
  228. return ToOptimizedSerializedResultUsingCache(info);
  229. }
  230. public object Get(GetChannels request)
  231. {
  232. var result = _liveTvManager.GetChannels(new ChannelQuery
  233. {
  234. ChannelType = request.Type,
  235. UserId = request.UserId,
  236. StartIndex = request.StartIndex,
  237. Limit = request.Limit
  238. }, CancellationToken.None).Result;
  239. return ToOptimizedSerializedResultUsingCache(result);
  240. }
  241. public object Get(GetChannel request)
  242. {
  243. var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(new Guid(request.UserId));
  244. var result = _liveTvManager.GetChannel(request.Id, CancellationToken.None, user).Result;
  245. return ToOptimizedSerializedResultUsingCache(result);
  246. }
  247. public object Get(GetPrograms request)
  248. {
  249. var query = new ProgramQuery
  250. {
  251. ChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToArray(),
  252. UserId = request.UserId
  253. };
  254. if (!string.IsNullOrEmpty(request.MinStartDate))
  255. {
  256. query.MinStartDate = DateTime.Parse(request.MinStartDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
  257. }
  258. if (!string.IsNullOrEmpty(request.MinEndDate))
  259. {
  260. query.MinEndDate = DateTime.Parse(request.MinEndDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
  261. }
  262. if (!string.IsNullOrEmpty(request.MaxStartDate))
  263. {
  264. query.MaxStartDate = DateTime.Parse(request.MaxStartDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
  265. }
  266. if (!string.IsNullOrEmpty(request.MaxEndDate))
  267. {
  268. query.MaxEndDate = DateTime.Parse(request.MaxEndDate, null, DateTimeStyles.RoundtripKind).ToUniversalTime();
  269. }
  270. var result = _liveTvManager.GetPrograms(query, CancellationToken.None).Result;
  271. return ToOptimizedSerializedResultUsingCache(result);
  272. }
  273. public object Get(GetRecommendedPrograms request)
  274. {
  275. var query = new RecommendedProgramQuery
  276. {
  277. UserId = request.UserId,
  278. IsAiring = request.IsAiring,
  279. Limit = request.Limit,
  280. HasAired = request.HasAired
  281. };
  282. var result = _liveTvManager.GetRecommendedPrograms(query, CancellationToken.None).Result;
  283. return ToOptimizedSerializedResultUsingCache(result);
  284. }
  285. public object Post(GetPrograms request)
  286. {
  287. return Get(request);
  288. }
  289. public object Get(GetRecordings request)
  290. {
  291. var result = _liveTvManager.GetRecordings(new RecordingQuery
  292. {
  293. ChannelId = request.ChannelId,
  294. UserId = request.UserId,
  295. GroupId = request.GroupId,
  296. StartIndex = request.StartIndex,
  297. Limit = request.Limit,
  298. Status = request.Status,
  299. SeriesTimerId = request.SeriesTimerId,
  300. IsInProgress = request.IsInProgress
  301. }, CancellationToken.None).Result;
  302. return ToOptimizedSerializedResultUsingCache(result);
  303. }
  304. public object Get(GetRecording request)
  305. {
  306. var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(new Guid(request.UserId));
  307. var result = _liveTvManager.GetRecording(request.Id, CancellationToken.None, user).Result;
  308. return ToOptimizedSerializedResultUsingCache(result);
  309. }
  310. public object Get(GetTimer request)
  311. {
  312. var result = _liveTvManager.GetTimer(request.Id, CancellationToken.None).Result;
  313. return ToOptimizedSerializedResultUsingCache(result);
  314. }
  315. public object Get(GetTimers request)
  316. {
  317. var result = _liveTvManager.GetTimers(new TimerQuery
  318. {
  319. ChannelId = request.ChannelId,
  320. SeriesTimerId = request.SeriesTimerId
  321. }, CancellationToken.None).Result;
  322. return ToOptimizedSerializedResultUsingCache(result);
  323. }
  324. public void Delete(DeleteRecording request)
  325. {
  326. AssertUserCanManageLiveTv();
  327. var task = _liveTvManager.DeleteRecording(request.Id);
  328. Task.WaitAll(task);
  329. }
  330. public void Delete(CancelTimer request)
  331. {
  332. AssertUserCanManageLiveTv();
  333. var task = _liveTvManager.CancelTimer(request.Id);
  334. Task.WaitAll(task);
  335. }
  336. public void Post(UpdateTimer request)
  337. {
  338. AssertUserCanManageLiveTv();
  339. var task = _liveTvManager.UpdateTimer(request, CancellationToken.None);
  340. Task.WaitAll(task);
  341. }
  342. public object Get(GetSeriesTimers request)
  343. {
  344. var result = _liveTvManager.GetSeriesTimers(new SeriesTimerQuery
  345. {
  346. SortOrder = request.SortOrder,
  347. SortBy = request.SortBy
  348. }, CancellationToken.None).Result;
  349. return ToOptimizedSerializedResultUsingCache(result);
  350. }
  351. public object Get(GetSeriesTimer request)
  352. {
  353. var result = _liveTvManager.GetSeriesTimer(request.Id, CancellationToken.None).Result;
  354. return ToOptimizedSerializedResultUsingCache(result);
  355. }
  356. public void Delete(CancelSeriesTimer request)
  357. {
  358. AssertUserCanManageLiveTv();
  359. var task = _liveTvManager.CancelSeriesTimer(request.Id);
  360. Task.WaitAll(task);
  361. }
  362. public void Post(UpdateSeriesTimer request)
  363. {
  364. AssertUserCanManageLiveTv();
  365. var task = _liveTvManager.UpdateSeriesTimer(request, CancellationToken.None);
  366. Task.WaitAll(task);
  367. }
  368. public object Get(GetDefaultTimer request)
  369. {
  370. if (string.IsNullOrEmpty(request.ProgramId))
  371. {
  372. var result = _liveTvManager.GetNewTimerDefaults(CancellationToken.None).Result;
  373. return ToOptimizedSerializedResultUsingCache(result);
  374. }
  375. else
  376. {
  377. var result = _liveTvManager.GetNewTimerDefaults(request.ProgramId, CancellationToken.None).Result;
  378. return ToOptimizedSerializedResultUsingCache(result);
  379. }
  380. }
  381. public object Get(GetProgram request)
  382. {
  383. var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(new Guid(request.UserId));
  384. var result = _liveTvManager.GetProgram(request.Id, CancellationToken.None, user).Result;
  385. return ToOptimizedSerializedResultUsingCache(result);
  386. }
  387. public void Post(CreateSeriesTimer request)
  388. {
  389. AssertUserCanManageLiveTv();
  390. var task = _liveTvManager.CreateSeriesTimer(request, CancellationToken.None);
  391. Task.WaitAll(task);
  392. }
  393. public void Post(CreateTimer request)
  394. {
  395. AssertUserCanManageLiveTv();
  396. var task = _liveTvManager.CreateTimer(request, CancellationToken.None);
  397. Task.WaitAll(task);
  398. }
  399. public object Get(GetRecordingGroups request)
  400. {
  401. var result = _liveTvManager.GetRecordingGroups(new RecordingGroupQuery
  402. {
  403. UserId = request.UserId
  404. }, CancellationToken.None).Result;
  405. return ToOptimizedSerializedResultUsingCache(result);
  406. }
  407. public object Get(GetRecordingGroup request)
  408. {
  409. var result = _liveTvManager.GetRecordingGroups(new RecordingGroupQuery
  410. {
  411. }, CancellationToken.None).Result;
  412. var group = result.Items.FirstOrDefault(i => string.Equals(i.Id, request.Id, StringComparison.OrdinalIgnoreCase));
  413. return ToOptimizedSerializedResultUsingCache(group);
  414. }
  415. public object Get(GetGuideInfo request)
  416. {
  417. return ToOptimizedResult(_liveTvManager.GetGuideInfo());
  418. }
  419. public void Post(ResetTuner request)
  420. {
  421. AssertUserCanManageLiveTv();
  422. var task = _liveTvManager.ResetTuner(request.Id, CancellationToken.None);
  423. Task.WaitAll(task);
  424. }
  425. }
  426. }