make live tv channels playable

pull/702/head
Luke Pulverenti 11 years ago
parent 04d1a53d19
commit 8c34f863fb

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

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

@ -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.

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

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

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

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

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

@ -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" />

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

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

Loading…
Cancel
Save