diff options
Diffstat (limited to 'MediaBrowser.Api/LiveTv/LiveTvService.cs')
| -rw-r--r-- | MediaBrowser.Api/LiveTv/LiveTvService.cs | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 68cfc9c44..b10d8d481 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.LiveTv; +using System; +using MediaBrowser.Controller.LiveTv; using MediaBrowser.Model.LiveTv; using ServiceStack.ServiceHost; using System.Collections.Generic; @@ -41,7 +42,7 @@ namespace MediaBrowser.Api.LiveTv [ApiMember(Name = "Id", Description = "Channel Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] public string Id { get; set; } } - + [Route("/LiveTv/Recordings", "GET")] [Api(Description = "Gets available live tv recordings.")] public class GetRecordings : IReturn<List<RecordingInfo>> @@ -50,9 +51,9 @@ namespace MediaBrowser.Api.LiveTv public string ServiceName { get; set; } } - [Route("/LiveTv/Guide", "GET")] + [Route("/LiveTv/Programs", "GET")] [Api(Description = "Gets available live tv epgs..")] - public class GetGuide : IReturn<List<ChannelGuide>> + public class GetPrograms : IReturn<List<ProgramInfo>> { [ApiMember(Name = "ServiceName", Description = "Live tv service name", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] public string ServiceName { get; set; } @@ -143,21 +144,15 @@ namespace MediaBrowser.Api.LiveTv return recordings.SelectMany(i => i); } - public object Get(GetGuide request) - { - var result = GetGuideAsync(request).Result; - - return ToOptimizedResult(result); - } - - private async Task<IEnumerable<ChannelGuide>> GetGuideAsync(GetGuide request) + public object Get(GetPrograms request) { - var service = GetServices(request.ServiceName) - .First(); - - var channels = request.ChannelIds.Split(','); + var result = _liveTvManager.GetPrograms(new ProgramQuery + { + ServiceName = request.ServiceName, + ChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToArray() + }); - return await service.GetChannelGuidesAsync(channels, CancellationToken.None).ConfigureAwait(false); + return ToOptimizedResult(result.ToList()); } } }
\ No newline at end of file |
