The Free Software Media System - Server Backend & API
update sync progress display
Luke Pulverentie76e8bb96cf1
diff --git a/MediaBrowser.Api/Sync/SyncService.cs b/MediaBrowser.Api/Sync/SyncService.csindex 5863e05e3a..593c3a108b 100644--- a/MediaBrowser.Api/Sync/SyncService.cs+++ b/MediaBrowser.Api/Sync/SyncService.cs@@ -244,7 +244,15 @@ namespace MediaBrowser.Api.Syncvar task = _syncManager.ReportSyncJobItemTransferBeginning(request.Id);Task.WaitAll(task);- return ToStaticFileResult(jobItem.OutputPath);+ return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions+ {+ Path = jobItem.OutputPath,+ OnError = () =>+ {+ var failedTask = _syncManager.ReportSyncJobItemTransferFailed(request.Id);+ Task.WaitAll(failedTask);+ }+ });}public object Get(GetSyncDialogOptions request)diff --git a/MediaBrowser.Controller/Net/StaticResultOptions.cs b/MediaBrowser.Controller/Net/StaticResultOptions.csindex 6a104554af..b5efc1b8fb 100644--- a/MediaBrowser.Controller/Net/StaticResultOptions.cs+++ b/MediaBrowser.Controller/Net/StaticResultOptions.cs@@ -19,6 +19,7 @@ namespace MediaBrowser.Controller.Netpublic IDictionary<string, string> ResponseHeaders { get; set; }public Action OnComplete { get; set; }+ public Action OnError { get; set; }public StaticResultOptions(){diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.csindex 961d58eb6e..9dc8d94e29 100644--- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs@@ -476,7 +476,8 @@ namespace MediaBrowser.Server.Implementations.HttpServerreturn new StreamWriter(stream, contentType, _logger){- OnComplete = options.OnComplete+ OnComplete = options.OnComplete,+ OnError = options.OnError};}diff --git a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.csindex daa5b86d96..a756f4aa8a 100644--- a/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs+++ b/MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs@@ -36,6 +36,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer}public Action OnComplete { get; set; }+ public Action OnError { get; set; }/// <summary>/// Initializes a new instance of the <see cref="StreamWriter" /> class.@@ -102,6 +103,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer{Logger.ErrorException("Error streaming data", ex);+ if (OnError != null)+ {+ OnError();+ }+throw;}finally