From 4c2623d540465088ce8f316eae21541ae807cd84 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 22 Dec 2013 13:58:51 -0500 Subject: support streaming of tv recordings --- MediaBrowser.Controller/Library/TVUtils.cs | 5 +++++ MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 11 ++++++++++- MediaBrowser.Controller/LiveTv/ILiveTvService.cs | 11 +++++------ MediaBrowser.Controller/LiveTv/ImageResponseInfo.cs | 19 ------------------- MediaBrowser.Controller/LiveTv/LiveTvProgram.cs | 5 ++++- MediaBrowser.Controller/LiveTv/ProgramInfo.cs | 6 ------ MediaBrowser.Controller/LiveTv/StreamResponseInfo.cs | 19 +++++++++++++++++++ .../MediaBrowser.Controller.csproj | 2 +- 8 files changed, 44 insertions(+), 34 deletions(-) delete mode 100644 MediaBrowser.Controller/LiveTv/ImageResponseInfo.cs create mode 100644 MediaBrowser.Controller/LiveTv/StreamResponseInfo.cs (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index 8b18754c03..d7504a86e4 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -124,6 +124,11 @@ namespace MediaBrowser.Controller.Library { var filename = Path.GetFileName(path); + if (string.Equals(path, "specials", StringComparison.OrdinalIgnoreCase)) + { + return 0; + } + // Look for one of the season folder names foreach (var name in SeasonFolderNames) { diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 40cc4bae5c..1d98dc7cf8 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using System.IO; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Querying; using System.Collections.Generic; @@ -153,6 +154,14 @@ namespace MediaBrowser.Controller.LiveTv /// The cancellation token. /// LiveTvRecording. Task GetInternalRecording(string id, CancellationToken cancellationToken); + + /// + /// Gets the recording stream. + /// + /// The identifier. + /// The cancellation token. + /// Task{Stream}. + Task GetRecordingStream(string id, CancellationToken cancellationToken); /// /// Gets the program. diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index 3a6cbf583c..31dbd8e998 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.IO; using System.Threading; using System.Threading.Tasks; @@ -85,7 +84,7 @@ namespace MediaBrowser.Controller.LiveTv /// The channel identifier. /// The cancellation token. /// Task{Stream}. - Task GetChannelImageAsync(string channelId, CancellationToken cancellationToken); + Task GetChannelImageAsync(string channelId, CancellationToken cancellationToken); /// /// Gets the recording image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to RecordingInfo @@ -93,7 +92,7 @@ namespace MediaBrowser.Controller.LiveTv /// The recording identifier. /// The cancellation token. /// Task{ImageResponseInfo}. - Task GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken); + Task GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken); /// /// Gets the program image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to ProgramInfo @@ -102,7 +101,7 @@ namespace MediaBrowser.Controller.LiveTv /// The channel identifier. /// The cancellation token. /// Task{ImageResponseInfo}. - Task GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken); + Task GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken); /// /// Gets the recordings asynchronous. @@ -146,7 +145,7 @@ namespace MediaBrowser.Controller.LiveTv /// The recording identifier. /// The cancellation token. /// Task{Stream}. - Task GetRecordingStream(string recordingId, CancellationToken cancellationToken); + Task GetRecordingStream(string recordingId, CancellationToken cancellationToken); /// /// Gets the channel stream. @@ -154,6 +153,6 @@ namespace MediaBrowser.Controller.LiveTv /// The recording identifier. /// The cancellation token. /// Task{Stream}. - Task GetChannelStream(string recordingId, CancellationToken cancellationToken); + Task GetChannelStream(string recordingId, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Controller/LiveTv/ImageResponseInfo.cs b/MediaBrowser.Controller/LiveTv/ImageResponseInfo.cs deleted file mode 100644 index d454a1ef8d..0000000000 --- a/MediaBrowser.Controller/LiveTv/ImageResponseInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.IO; - -namespace MediaBrowser.Controller.LiveTv -{ - public class ImageResponseInfo - { - /// - /// Gets or sets the stream. - /// - /// The stream. - public Stream Stream { get; set; } - - /// - /// Gets or sets the type of the MIME. - /// - /// The type of the MIME. - public string MimeType { get; set; } - } -} diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index babd9f54c5..abacc0c18e 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -1,4 +1,5 @@ using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.LiveTv { @@ -15,13 +16,15 @@ namespace MediaBrowser.Controller.LiveTv public ProgramInfo ProgramInfo { get; set; } + public ChannelType ChannelType { get; set; } + public string ServiceName { get; set; } public override string MediaType { get { - return ProgramInfo.IsVideo ? Model.Entities.MediaType.Video : Model.Entities.MediaType.Audio; + return ChannelType == ChannelType.TV ? Model.Entities.MediaType.Video : Model.Entities.MediaType.Audio; } } diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index 671c4b5914..72ecb3ec99 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -127,12 +127,6 @@ namespace MediaBrowser.Controller.LiveTv /// true if this instance is series; otherwise, false. public bool IsSeries { get; set; } - /// - /// Gets or sets a value indicating whether this instance is video. - /// - /// true if this instance is video; otherwise, false. - public bool IsVideo { get; set; } - /// /// Gets or sets a value indicating whether this instance is live. /// diff --git a/MediaBrowser.Controller/LiveTv/StreamResponseInfo.cs b/MediaBrowser.Controller/LiveTv/StreamResponseInfo.cs new file mode 100644 index 0000000000..c3b438c5ee --- /dev/null +++ b/MediaBrowser.Controller/LiveTv/StreamResponseInfo.cs @@ -0,0 +1,19 @@ +using System.IO; + +namespace MediaBrowser.Controller.LiveTv +{ + public class StreamResponseInfo + { + /// + /// Gets or sets the stream. + /// + /// The stream. + public Stream Stream { get; set; } + + /// + /// Gets or sets the type of the MIME. + /// + /// The type of the MIME. + public string MimeType { get; set; } + } +} diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index a200f610b5..de9aa3b9f9 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -112,7 +112,7 @@ - + -- cgit v1.2.3