diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index f8e7b63709..6a8457ecb2 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -27,6 +27,13 @@ namespace MediaBrowser.Api.LiveTv { // Add filter by service if needed, and/or other filters } + + [Route("/LiveTv/EPG", "GET")] + [Api(Description = "Gets available live tv epgs..")] + public class GetEpg : IReturn> + { + // Add filter by service if needed, and/or other filters + } public class LiveTvService : BaseApiService { @@ -92,5 +99,23 @@ namespace MediaBrowser.Api.LiveTv return recordings.SelectMany(i => i); } + + public object Get(GetEpg request) + { + var result = GetEpgAsync(request).Result; + + return ToOptimizedResult(result); + } + + private async Task> GetEpgAsync(GetEpg request) + { + var services = _liveTvManager.Services; + + var tasks = services.Select(i => i.GetEpgAsync(CancellationToken.None)); + + var epg = await Task.WhenAll(tasks).ConfigureAwait(false); + + return epg.SelectMany(i => i); + } } -} +} \ No newline at end of file diff --git a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs index 547fc6287c..8d8b638477 100644 --- a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs @@ -13,6 +13,10 @@ namespace MediaBrowser.Controller.LiveTv /// The name. public string Name { get; set; } + /// + /// Get or sets the Id. + /// + /// The id of the channel. public string Id { get; set; } /// diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index a1e002bc82..86058696d3 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -24,5 +24,7 @@ namespace MediaBrowser.Controller.LiveTv Task> GetChannelsAsync(CancellationToken cancellationToken); Task> GetRecordingsAsync(CancellationToken cancellationToken); + + Task> GetEpgAsync(CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index 8a6197857d..e254f9007c 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -230,6 +230,12 @@ LiveTv\ChannelType.cs + + LiveTv\EpgFullInfo.cs + + + LiveTv\EpgInfo.cs + LiveTv\LiveTvServiceInfo.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index dfff0356bc..b8625c7c67 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -217,6 +217,12 @@ LiveTv\ChannelType.cs + + LiveTv\EpgFullInfo.cs + + + LiveTv\EpgInfo.cs + LiveTv\LiveTvServiceInfo.cs diff --git a/MediaBrowser.Model/LiveTv/EpgFullInfo.cs b/MediaBrowser.Model/LiveTv/EpgFullInfo.cs new file mode 100644 index 0000000000..8e48537b82 --- /dev/null +++ b/MediaBrowser.Model/LiveTv/EpgFullInfo.cs @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000000..3573e5deb0 --- /dev/null +++ b/MediaBrowser.Model/LiveTv/EpgInfo.cs @@ -0,0 +1,32 @@ +using System; + +namespace MediaBrowser.Model.LiveTv +{ + public class EpgInfo + { + /// + /// Id of the program. + /// + public string Id { 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/LiveTv/RecordingInfo.cs b/MediaBrowser.Model/LiveTv/RecordingInfo.cs index dab37a3812..55a30a4b38 100644 --- a/MediaBrowser.Model/LiveTv/RecordingInfo.cs +++ b/MediaBrowser.Model/LiveTv/RecordingInfo.cs @@ -1,27 +1,78 @@ using System; +using System.Collections.Generic; namespace MediaBrowser.Model.LiveTv { public class RecordingInfo { - public string ChannelId { get; set; } - - public string ChannelName { get; set; } - + /// + /// Id of the recording. + /// public string Id { get; set; } + /// + /// ChannelId of the recording. + /// + public string ChannelId { get; set; } + + /// + /// ChannelName of the recording. + /// + public string ChannelName { get; set; } + + /// + /// Name of the recording. + /// public string Name { get; set; } + /// + /// Description of the recording. + /// public string Description { get; set; } /// - /// The start date of the recording, in UTC + /// The start date of the recording, in UTC. /// public DateTime StartDate { get; set; } /// - /// The end date of the recording, in UTC + /// The end date of the recording, in UTC. /// public DateTime EndDate { get; set; } + + /// + /// Status of the recording. + /// + public string Status { get; set; } //TODO: Enum for status?? Difference NextPvr,Argus,... + + /// + /// Quality of the Recording. + /// + public string Quality { get; set; } // TODO: Enum for quality?? Difference NextPvr,Argus,... + + /// + /// Recurring recording? + /// + public bool Recurring { get; set; } + + /// + /// Parent recurring. + /// + public string RecurringParent { get; set; } + + /// + /// Start date for the recurring, in UTC. + /// + public DateTime RecurrringStartDate { get; set; } + + /// + /// End date for the recurring, in UTC + /// + public DateTime RecurringEndDate { get; set; } + + /// + /// When do we need the recording? + /// + public List DayMask { get; set; } } -} +} \ No newline at end of file diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index fc3b270f6b..30ce53121c 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -59,6 +59,8 @@ + +