From d721c92bba44bcc50da5028190ec36ccf19257ac Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 7 Oct 2016 11:33:07 -0400 Subject: [PATCH 1/2] updated translations --- .../LiveTv/LiveTvManager.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index fd9e75b6f7..60b5b023ae 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -2534,13 +2534,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv }; } - class LiveStreamData - { - internal MediaSourceInfo Info; - internal string ItemId; - internal bool IsChannel; - } - public async Task CloseLiveStream(string id) { var parts = id.Split(new[] { '_' }, 2); From 1591b16e003700d119732c2c7aa38d34583263dd Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 7 Oct 2016 11:53:00 -0400 Subject: [PATCH 2/2] fix live stream --- MediaBrowser.Api/LiveTv/LiveTvService.cs | 42 ++++-------------------- MediaBrowser.Api/StartupWizardService.cs | 2 +- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 8b5e7075df..ebfced0f41 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -19,6 +19,7 @@ using System.Threading.Tasks; using CommonIO; using MediaBrowser.Api.Playback.Progressive; using MediaBrowser.Controller.Configuration; +using MediaBrowser.Server.Implementations.LiveTv.EmbyTV; namespace MediaBrowser.Api.LiveTv { @@ -674,8 +675,6 @@ namespace MediaBrowser.Api.LiveTv { public string Id { get; set; } public string Container { get; set; } - public long T { get; set; } - public long S { get; set; } } public class LiveTvService : BaseApiService @@ -699,45 +698,18 @@ namespace MediaBrowser.Api.LiveTv _fileSystem = fileSystem; } - public object Get(GetLiveStreamFile request) + public async Task Get(GetLiveStreamFile request) { - var filePath = Path.Combine(_config.ApplicationPaths.TranscodingTempPath, request.Id + ".ts"); - + var directStreamProvider = (await EmbyTV.Current.GetLiveStream(request.Id).ConfigureAwait(false)) as IDirectStreamProvider; var outputHeaders = new Dictionary(StringComparer.OrdinalIgnoreCase); - outputHeaders["Content-Type"] = MediaBrowser.Model.Net.MimeTypes.GetMimeType(filePath); - - long startPosition = 0; + // TODO: Don't hardcode this + outputHeaders["Content-Type"] = Model.Net.MimeTypes.GetMimeType("file.ts"); - if (request.T > 0) + var streamSource = new ProgressiveFileCopier(directStreamProvider, outputHeaders, null, Logger, CancellationToken.None) { - var now = DateTime.UtcNow; - - var totalTicks = now.Ticks - request.S; - - if (totalTicks > 0) - { - double requestedOffset = request.T; - requestedOffset = Math.Max(0, requestedOffset - TimeSpan.FromSeconds(10).Ticks); - - var pct = requestedOffset / totalTicks; - - Logger.Info("Live stream offset pct {0}", pct); - - var bytes = new FileInfo(filePath).Length; - Logger.Info("Live stream total bytes {0}", bytes); - startPosition = Convert.ToInt64(pct * bytes); - } - } - - Logger.Info("Live stream starting byte position {0}", startPosition); - - var streamSource = new ProgressiveFileCopier(_fileSystem, filePath, outputHeaders, null, Logger, CancellationToken.None) - { - AllowEndOfFile = false, - StartPosition = startPosition + AllowEndOfFile = false }; - return ResultFactory.GetAsyncStreamWriter(streamSource); } diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index 4c5abc996a..5caea2b151 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -114,7 +114,7 @@ namespace MediaBrowser.Api config.EnableLocalizedGuids = true; config.EnableStandaloneMusicKeys = true; config.EnableCaseSensitiveItemIds = true; - //config.EnableFolderView = true; + config.EnableFolderView = true; config.SchemaVersion = 109; config.EnableSimpleArtistDetection = true; }