From ed1f2a8a0c0e2502438aed80369e94150f3bd32d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 31 Oct 2016 16:00:26 -0400 Subject: [PATCH] update SubtitleService --- MediaBrowser.Api/Subtitles/SubtitleService.cs | 7 ++++--- .../HttpServer/StreamWriter.cs | 4 +--- .../MediaBrowser.Server.Implementations.csproj | 5 ----- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.cs index ce02cf65e..f7ff3d162 100644 --- a/MediaBrowser.Api/Subtitles/SubtitleService.cs +++ b/MediaBrowser.Api/Subtitles/SubtitleService.cs @@ -215,9 +215,9 @@ namespace MediaBrowser.Api.Subtitles return await ResultFactory.GetStaticFileResult(Request, subtitleStream.Path).ConfigureAwait(false); } - using (var stream = await GetSubtitles(request).ConfigureAwait(false)) + if (string.Equals(request.Format, "vtt", StringComparison.OrdinalIgnoreCase) && request.AddVttTimeMap) { - if (string.Equals(request.Format, "vtt", StringComparison.OrdinalIgnoreCase) && request.AddVttTimeMap) + using (var stream = await GetSubtitles(request).ConfigureAwait(false)) { using (var reader = new StreamReader(stream)) { @@ -228,8 +228,9 @@ namespace MediaBrowser.Api.Subtitles return ResultFactory.GetResult(text, MimeTypes.GetMimeType("file." + request.Format)); } } - return ResultFactory.GetResult(stream, MimeTypes.GetMimeType("file." + request.Format)); } + + return ResultFactory.GetResult(await GetSubtitles(request).ConfigureAwait(false), MimeTypes.GetMimeType("file." + request.Format)); } private Task GetSubtitles(GetSubtitle request) diff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs index 60d0d7c41..7b88f12df 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs @@ -88,8 +88,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer Headers["Content-Length"] = source.Length.ToString(UsCulture); } - private const int BufferSize = 81920; - public async Task WriteToAsync(Stream responseStream, CancellationToken cancellationToken) { try @@ -102,7 +100,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer { using (var src = SourceStream) { - await src.CopyToAsync(responseStream, BufferSize).ConfigureAwait(false); + await src.CopyToAsync(responseStream).ConfigureAwait(false); } } } diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index f3224127a..e6f203120 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -79,7 +79,6 @@ True - @@ -87,16 +86,12 @@ - ..\ThirdParty\ServiceStack\ServiceStack.dll - - ..\ThirdParty\ServiceStack\ServiceStack.Common.dll - ..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll