make live tv channels playable

This commit is contained in:
Luke Pulverenti 2013-12-29 13:53:56 -05:00
parent 04d1a53d19
commit 8c34f863fb
11 changed files with 61 additions and 42 deletions

View File

@ -198,6 +198,13 @@ namespace MediaBrowser.Api.LiveTv
public string Id { get; set; }
}
[Route("/LiveTv/Channels/{Id}/Stream", "GET")]
public class GetInternalChannelStream
{
[ApiMember(Name = "Id", Description = "Channel Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get; set; }
}
public class LiveTvService : BaseApiService
{
private readonly ILiveTvManager _liveTvManager;
@ -399,6 +406,13 @@ namespace MediaBrowser.Api.LiveTv
return ToStreamResult(stream.Stream, stream.MimeType);
}
public object Get(GetInternalChannelStream request)
{
var stream = _liveTvManager.GetChannelStream(request.Id, CancellationToken.None).Result;
return ToStreamResult(stream.Stream, stream.MimeType);
}
public object Get(GetRecordingGroups request)
{
var result = _liveTvManager.GetRecordingGroups(new RecordingGroupQuery

View File

@ -902,6 +902,22 @@ namespace MediaBrowser.Api.Playback
item = recording;
}
else if (string.Equals(request.Type, "Channel", StringComparison.OrdinalIgnoreCase))
{
var channel = LiveTvManager.GetInternalChannel(request.Id);
state.VideoType = VideoType.VideoFile;
state.IsInputVideo = string.Equals(channel.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase);
state.PlayableStreamFileNames = new List<string>();
state.MediaPath = string.Format("http://localhost:{0}/mediabrowser/LiveTv/Channels/{1}/Stream",
ServerConfigurationManager.Configuration.HttpServerPortNumber,
request.Id);
state.IsRemote = true;
item = channel;
}
else
{
item = DtoService.GetItemByDtoId(request.Id);

View File

@ -162,6 +162,14 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Stream}.</returns>
Task<StreamResponseInfo> GetRecordingStream(string id, CancellationToken cancellationToken);
/// <summary>
/// Gets the channel stream.
/// </summary>
/// <param name="id">The identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{StreamResponseInfo}.</returns>
Task<StreamResponseInfo> GetChannelStream(string id, CancellationToken cancellationToken);
/// <summary>
/// Gets the program.

View File

@ -150,9 +150,9 @@ namespace MediaBrowser.Controller.LiveTv
/// <summary>
/// Gets the channel stream.
/// </summary>
/// <param name="recordingId">The recording identifier.</param>
/// <param name="channelId">The channel identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Stream}.</returns>
Task<StreamResponseInfo> GetChannelStream(string recordingId, CancellationToken cancellationToken);
Task<StreamResponseInfo> GetChannelStream(string channelId, CancellationToken cancellationToken);
}
}

View File

@ -2,7 +2,7 @@
<MonoDevelop.Ide.Workspace ActiveConfiguration="Release Mono" />
<MonoDevelop.Ide.Workbench ActiveDocument="MediaBrowser.Server.Mono\app.config">
<Files>
<File FileName="MediaBrowser.Server.Mono\app.config" Line="1" Column="39" />
<File FileName="MediaBrowser.Server.Mono\app.config" Line="11" Column="68" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>

View File

@ -751,41 +751,13 @@ namespace MediaBrowser.Providers.Movies
? minimunRelease.iso_3166_1 + "-" + minimunRelease.certification
: null;
}
if (ourRelease.release_date != default(DateTime))
{
if (ourRelease.release_date.Year != 1)
{
movie.PremiereDate = ourRelease.release_date.ToUniversalTime();
movie.ProductionYear = ourRelease.release_date.Year;
}
}
else if (usRelease.release_date != default(DateTime))
{
if (usRelease.release_date.Year != 1)
{
movie.PremiereDate = usRelease.release_date.ToUniversalTime();
movie.ProductionYear = usRelease.release_date.Year;
}
}
else if (minimunRelease.release_date != default(DateTime))
{
if (minimunRelease.release_date.Year != 1)
{
movie.PremiereDate = minimunRelease.release_date.ToUniversalTime();
movie.ProductionYear = minimunRelease.release_date.Year;
}
}
}
else
if (movieData.release_date.Year != 1)
{
if (movieData.release_date.Year != 1)
{
//no specific country release info at all
movie.PremiereDate = movieData.release_date.ToUniversalTime();
movie.ProductionYear = movieData.release_date.Year;
}
//no specific country release info at all
movie.PremiereDate = movieData.release_date.ToUniversalTime();
movie.ProductionYear = movieData.release_date.Year;
}
// If that didn't find a rating and we are a boxset, use the one from our first child

View File

@ -441,7 +441,7 @@ namespace MediaBrowser.Providers.TV
{
_logger.Info("Creating Season {0} entry for {1}", seasonNumber, series.Name);
var name = string.Format("Season {0}", seasonNumber.ToString(UsCulture));
var name = seasonNumber == 0 ? _config.Configuration.SeasonZeroDisplayName : string.Format("Season {0}", seasonNumber.ToString(UsCulture));
var season = new Season
{

View File

@ -166,6 +166,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return await service.GetRecordingStream(recording.Id, cancellationToken).ConfigureAwait(false);
}
public async Task<StreamResponseInfo> GetChannelStream(string id, CancellationToken cancellationToken)
{
var service = ActiveService;
var channel = GetInternalChannel(id);
return await service.GetRecordingStream(channel.ChannelInfo.Id, cancellationToken).ConfigureAwait(false);
}
private async Task<LiveTvChannel> GetChannel(ChannelInfo channelInfo, string serviceName, CancellationToken cancellationToken)
{
var path = Path.Combine(_appPaths.ItemsByNamePath, "channels", _fileSystem.GetValidFilename(serviceName), _fileSystem.GetValidFilename(channelInfo.Name));

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.292</version>
<version>3.0.293</version>
<title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.292" />
<dependency id="MediaBrowser.Common" version="3.0.293" />
<dependency id="NLog" version="2.1.0" />
<dependency id="SimpleInjector" version="2.4.0" />
<dependency id="sharpcompress" version="0.10.2" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.292</version>
<version>3.0.293</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.292</version>
<version>3.0.293</version>
<title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.292" />
<dependency id="MediaBrowser.Common" version="3.0.293" />
</dependencies>
</metadata>
<files>