diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 6c3fcbac1..72e5eee92 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -32,17 +32,17 @@ namespace MediaBrowser.Api.LiveTv public string ServiceName { get; set; } } - [Route("/LiveTv/EPG", "GET")] + [Route("/LiveTv/Guide", "GET")] [Api(Description = "Gets available live tv epgs..")] - public class GetEpg : IReturn + public class GetGuide : IReturn> { - [ApiMember(Name = "ServiceName", Description = "The live tv service name", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] + [ApiMember(Name = "ServiceName", Description = "Live tv service name", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] public string ServiceName { get; set; } - [ApiMember(Name = "ChannelId", Description = "The channel id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] - public string ChannelId { get; set; } + [ApiMember(Name = "ChannelIds", Description = "The channels to return guide information for.", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] + public string ChannelIds { get; set; } } - + public class LiveTvService : BaseApiService { private readonly ILiveTvManager _liveTvManager; @@ -112,28 +112,33 @@ namespace MediaBrowser.Api.LiveTv { var services = GetServices(request.ServiceName); - var tasks = services.Select(i => i.GetRecordingsAsync(CancellationToken.None)); + var query = new RecordingQuery + { + + }; + + var tasks = services.Select(i => i.GetRecordingsAsync(query, CancellationToken.None)); var recordings = await Task.WhenAll(tasks).ConfigureAwait(false); - return recordings.SelectMany(i => i).Select(_liveTvManager.GetRecordingInfo); + return recordings.SelectMany(i => i); } - public object Get(GetEpg request) + public object Get(GetGuide request) { - var result = GetEpgAsync(request).Result; + var result = GetGuideAsync(request).Result; return ToOptimizedResult(result); } - private async Task GetEpgAsync(GetEpg request) + private async Task> GetGuideAsync(GetGuide request) { var service = GetServices(request.ServiceName) .First(); - var epg = await service.GetEpgAsync(request.ChannelId, CancellationToken.None).ConfigureAwait(false); + var channels = request.ChannelIds.Split(','); - return epg; + return await service.GetChannelGuidesAsync(channels, CancellationToken.None).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs index 8d8b63847..721c1e40a 100644 --- a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs @@ -13,6 +13,12 @@ namespace MediaBrowser.Controller.LiveTv /// The name. public string Name { get; set; } + /// + /// Gets or sets the number. + /// + /// The number. + public string Number { get; set; } + /// /// Get or sets the Id. /// diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index a48a6a551..62bfdf3e5 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -27,7 +27,5 @@ namespace MediaBrowser.Controller.LiveTv /// The info. /// ChannelInfoDto. ChannelInfoDto GetChannelInfoDto(ChannelInfo info); - - RecordingInfo GetRecordingInfo(RecordingInfo info); } } diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index 8cad0bd35..5c019ae8c 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -26,16 +26,17 @@ namespace MediaBrowser.Controller.LiveTv /// /// Gets the recordings asynchronous. /// + /// The query. /// The cancellation token. /// Task{IEnumerable{RecordingInfo}}. - Task> GetRecordingsAsync(CancellationToken cancellationToken); + Task> GetRecordingsAsync(RecordingQuery query, CancellationToken cancellationToken); /// - /// Gets the epg asynchronous. + /// Gets the channel guides. /// - /// The channel identifier. + /// The channel identifier list. /// The cancellation token. - /// Task{EpgFullInfo}. - Task GetEpgAsync(string channelId, CancellationToken cancellationToken); + /// Task{IEnumerable{ChannelGuide}}. + Task> GetChannelGuidesAsync(IEnumerable channelIdList, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index a5bff2b40..726df1eb5 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -224,24 +224,27 @@ IO\IZipClient.cs + + LiveTv\ChannelGuide.cs + LiveTv\ChannelInfoDto.cs LiveTv\ChannelType.cs - - LiveTv\EpgFullInfo.cs - - - LiveTv\EpgInfo.cs - LiveTv\LiveTvServiceInfo.cs + + LiveTv\ProgramInfo.cs + LiveTv\RecordingInfo.cs + + LiveTv\RecordingQuery.cs + Logging\ILogger.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index 60deab47d..471db6f25 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -211,24 +211,27 @@ IO\IZipClient.cs + + LiveTv\ChannelGuide.cs + LiveTv\ChannelInfoDto.cs LiveTv\ChannelType.cs - - LiveTv\EpgFullInfo.cs - - - LiveTv\EpgInfo.cs - LiveTv\LiveTvServiceInfo.cs + + LiveTv\ProgramInfo.cs + LiveTv\RecordingInfo.cs + + LiveTv\RecordingQuery.cs + Logging\ILogger.cs diff --git a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs index 15c905581..8daaa75ca 100644 --- a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs @@ -12,7 +12,17 @@ namespace MediaBrowser.Model.LiveTv /// The name. public string Name { get; set; } + /// + /// Gets or sets the identifier. + /// + /// The identifier. public string Id { get; set; } + + /// + /// Gets or sets the number. + /// + /// The number. + public string Number { get; set; } /// /// Gets or sets the name of the service. diff --git a/MediaBrowser.Model/LiveTv/EpgFullInfo.cs b/MediaBrowser.Model/LiveTv/EpgFullInfo.cs deleted file mode 100644 index 8e48537b8..000000000 --- a/MediaBrowser.Model/LiveTv/EpgFullInfo.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; - -namespace MediaBrowser.Model.LiveTv -{ - public class EpgFullInfo - { - /// - /// ChannelId for the EPG. - /// - public string ChannelId { get; set; } - - /// - /// List of all the programs for a specific channel - /// - public List EpgInfos { get; set; } - } -} diff --git a/MediaBrowser.Model/LiveTv/EpgInfo.cs b/MediaBrowser.Model/LiveTv/EpgInfo.cs deleted file mode 100644 index c60064882..000000000 --- a/MediaBrowser.Model/LiveTv/EpgInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; - -namespace MediaBrowser.Model.LiveTv -{ - public class EpgInfo - { - /// - /// Id of the program. - /// - public string Id { get; set; } - - /// - /// Name of the program - /// - public string Name { get; set; } - - /// - /// Description of the progam. - /// - public string Description { get; set; } - - /// - /// The start date of the program, in UTC. - /// - public DateTime StartDate { get; set; } - - /// - /// The end date of the program, in UTC. - /// - public DateTime EndDate { get; set; } - - /// - /// Genre of the program. - /// - public string Genre { get; set; } - } -} \ No newline at end of file diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 48f298778..6ff6fcf73 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -60,8 +60,9 @@ - - + + + diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 0b36c8023..05bac17c3 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -40,13 +40,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv Name = info.Name, ServiceName = info.ServiceName, ChannelType = info.ChannelType, - Id = info.Id + Id = info.Id, + Number = info.Number }; } - - public RecordingInfo GetRecordingInfo(RecordingInfo info) - { - return info; - } } }