support streaming of tv recordings

This commit is contained in:
Luke Pulverenti
2013-12-22 13:58:51 -05:00
parent cac101cc21
commit 4c2623d540
19 changed files with 191 additions and 47 deletions

View File

@@ -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)
{

View File

@@ -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
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>LiveTvRecording.</returns>
Task<LiveTvRecording> GetInternalRecording(string id, CancellationToken cancellationToken);
/// <summary>
/// Gets the recording stream.
/// </summary>
/// <param name="id">The identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Stream}.</returns>
Task<StreamResponseInfo> GetRecordingStream(string id, CancellationToken cancellationToken);
/// <summary>
/// Gets the program.

View File

@@ -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
/// <param name="channelId">The channel identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Stream}.</returns>
Task<ImageResponseInfo> GetChannelImageAsync(string channelId, CancellationToken cancellationToken);
Task<StreamResponseInfo> GetChannelImageAsync(string channelId, CancellationToken cancellationToken);
/// <summary>
/// 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
/// <param name="recordingId">The recording identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{ImageResponseInfo}.</returns>
Task<ImageResponseInfo> GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken);
Task<StreamResponseInfo> GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken);
/// <summary>
/// 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
/// <param name="channelId">The channel identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{ImageResponseInfo}.</returns>
Task<ImageResponseInfo> GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken);
Task<StreamResponseInfo> GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken);
/// <summary>
/// Gets the recordings asynchronous.
@@ -146,7 +145,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="recordingId">The recording identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Stream}.</returns>
Task<Stream> GetRecordingStream(string recordingId, CancellationToken cancellationToken);
Task<StreamResponseInfo> GetRecordingStream(string recordingId, CancellationToken cancellationToken);
/// <summary>
/// Gets the channel stream.
@@ -154,6 +153,6 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="recordingId">The recording identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Stream}.</returns>
Task<Stream> GetChannelStream(string recordingId, CancellationToken cancellationToken);
Task<StreamResponseInfo> GetChannelStream(string recordingId, CancellationToken cancellationToken);
}
}

View File

@@ -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;
}
}

View File

@@ -127,12 +127,6 @@ namespace MediaBrowser.Controller.LiveTv
/// <value><c>true</c> if this instance is series; otherwise, <c>false</c>.</value>
public bool IsSeries { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is video.
/// </summary>
/// <value><c>true</c> if this instance is video; otherwise, <c>false</c>.</value>
public bool IsVideo { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is live.
/// </summary>

View File

@@ -2,7 +2,7 @@
namespace MediaBrowser.Controller.LiveTv
{
public class ImageResponseInfo
public class StreamResponseInfo
{
/// <summary>
/// Gets or sets the stream.

View File

@@ -112,7 +112,7 @@
<Compile Include="LiveTv\ChannelInfo.cs" />
<Compile Include="LiveTv\ILiveTvManager.cs" />
<Compile Include="LiveTv\ILiveTvService.cs" />
<Compile Include="LiveTv\ImageResponseInfo.cs" />
<Compile Include="LiveTv\StreamResponseInfo.cs" />
<Compile Include="LiveTv\LiveTvProgram.cs" />
<Compile Include="LiveTv\LiveTvRecording.cs" />
<Compile Include="LiveTv\ProgramInfo.cs" />