The Free Software Media System - Server Backend & API
make live tv channels playable
Luke Pulverenti8c34f863fb6c
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.csindex 588fad8bd3..61883ddaae 100644--- a/MediaBrowser.Api/LiveTv/LiveTvService.cs+++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs@@ -198,6 +198,13 @@ namespace MediaBrowser.Api.LiveTvpublic 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.LiveTvreturn 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 RecordingGroupQuerydiff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.csindex 34ec15a709..1e2ae58b25 100644--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs@@ -902,6 +902,22 @@ namespace MediaBrowser.Api.Playbackitem = 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);diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.csindex 2458d4db4d..c26e29d942 100644--- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs+++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs@@ -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.diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.csindex 31dbd8e998..f8efbce635 100644--- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs+++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs@@ -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);}}diff --git a/MediaBrowser.Mono.userprefs b/MediaBrowser.Mono.userprefsindex 3ca97e6bdd..d303a7993e 100644--- a/MediaBrowser.Mono.userprefs+++ b/MediaBrowser.Mono.userprefs@@ -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>diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.csindex c6c9df6f7d..dc267b37cc 100644--- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs+++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs@@ -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 childdiff --git a/MediaBrowser.Providers/TV/SeriesPostScanTask.cs b/MediaBrowser.Providers/TV/SeriesPostScanTask.csindex b889b991e9..8663c0b4c8 100644--- a/MediaBrowser.Providers/TV/SeriesPostScanTask.cs+++ b/MediaBrowser.Providers/TV/SeriesPostScanTask.cs@@ -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{diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.csindex 2ef68c2392..a3790b097a 100644--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs@@ -166,6 +166,15 @@ namespace MediaBrowser.Server.Implementations.LiveTvreturn 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));diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspecindex 1df7b17bf3..cdbd51d84e 100644--- a/Nuget/MediaBrowser.Common.Internal.nuspec+++ b/Nuget/MediaBrowser.Common.Internal.nuspec@@ -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" />diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspecindex 14e09d90cf..20bdf1300a 100644--- a/Nuget/MediaBrowser.Common.nuspec+++ b/Nuget/MediaBrowser.Common.nuspec@@ -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>diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspecindex d49dfb85db..8f040c00ff 100644--- a/Nuget/MediaBrowser.Server.Core.nuspec+++ b/Nuget/MediaBrowser.Server.Core.nuspec@@ -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>