From cc3e8dbbb942977d8f46a0a16e3802c0e5d0c94b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 12 Jan 2014 10:58:47 -0500 Subject: added suggested live tv page --- MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 9 +++++++++ MediaBrowser.Controller/LiveTv/ILiveTvService.cs | 25 +++++++++++++++++------- MediaBrowser.Controller/LiveTv/LiveTvProgram.cs | 21 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 7 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 1856182da2..31c336932f 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -240,5 +240,14 @@ namespace MediaBrowser.Controller.LiveTv /// /// GuideInfo. GuideInfo GetGuideInfo(); + + /// + /// Gets the recommended programs. + /// + /// The query. + /// The cancellation token. + /// Task{QueryResult{ProgramInfoDto}}. + Task> GetRecommendedPrograms(RecommendedProgramQuery query, + CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index 1e535139ce..81613c1df6 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -37,7 +38,7 @@ namespace MediaBrowser.Controller.LiveTv /// The cancellation token. /// Task. Task CancelSeriesTimerAsync(string timerId, CancellationToken cancellationToken); - + /// /// Deletes the recording asynchronous. /// @@ -77,7 +78,7 @@ namespace MediaBrowser.Controller.LiveTv /// The cancellation token. /// Task. Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken); - + /// /// Gets the channel image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to ChannelInfo /// @@ -102,7 +103,7 @@ namespace MediaBrowser.Controller.LiveTv /// The cancellation token. /// Task{ImageResponseInfo}. Task GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken); - + /// /// Gets the recordings asynchronous. /// @@ -123,21 +124,23 @@ namespace MediaBrowser.Controller.LiveTv /// The cancellation token. /// Task{TimerInfo}. Task GetNewTimerDefaultsAsync(CancellationToken cancellationToken); - + /// /// Gets the series timers asynchronous. /// /// The cancellation token. /// Task{IEnumerable{SeriesTimerInfo}}. Task> GetSeriesTimersAsync(CancellationToken cancellationToken); - + /// /// Gets the programs asynchronous. /// /// The channel identifier. + /// The start date UTC. + /// The end date UTC. /// The cancellation token. /// Task{IEnumerable{ProgramInfo}}. - Task> GetProgramsAsync(string channelId, CancellationToken cancellationToken); + Task> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken); /// /// Gets the recording stream. @@ -162,5 +165,13 @@ namespace MediaBrowser.Controller.LiveTv /// The cancellation token. /// Task. Task CloseLiveStream(string id, CancellationToken cancellationToken); + + /// + /// Records the live stream. + /// + /// The identifier. + /// The cancellation token. + /// Task. + Task RecordLiveStream(string id, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index abacc0c18e..aceb32885e 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -1,5 +1,6 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Model.LiveTv; +using System; namespace MediaBrowser.Controller.LiveTv { @@ -28,6 +29,26 @@ namespace MediaBrowser.Controller.LiveTv } } + public bool IsAiring + { + get + { + var now = DateTime.UtcNow; + + return now >= ProgramInfo.StartDate && now < ProgramInfo.EndDate; + } + } + + public bool HasAired + { + get + { + var now = DateTime.UtcNow; + + return now >= ProgramInfo.EndDate; + } + } + public override string GetClientTypeName() { return "Program"; -- cgit v1.2.3