aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-10-02 14:30:27 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-10-02 14:30:27 -0400
commite76e8bb96cf119380582d573fa057fd258c839a0 (patch)
tree8830f42476c898fb35d363c0d7ff448a54418acd
parent713083b34a467610d0d3ca15d8934551be6d0248 (diff)
update sync progress display
-rw-r--r--MediaBrowser.Api/Sync/SyncService.cs10
-rw-r--r--MediaBrowser.Controller/Net/StaticResultOptions.cs1
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs3
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/StreamWriter.cs6
4 files changed, 18 insertions, 2 deletions
diff --git a/MediaBrowser.Api/Sync/SyncService.cs b/MediaBrowser.Api/Sync/SyncService.cs
index 5863e05e3..593c3a108 100644
--- a/MediaBrowser.Api/Sync/SyncService.cs
+++ b/MediaBrowser.Api/Sync/SyncService.cs
@@ -244,7 +244,15 @@ namespace MediaBrowser.Api.Sync
var 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.cs
index 6a104554a..b5efc1b8f 100644
--- a/MediaBrowser.Controller/Net/StaticResultOptions.cs
+++ b/MediaBrowser.Controller/Net/StaticResultOptions.cs
@@ -19,6 +19,7 @@ namespace MediaBrowser.Controller.Net
public 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.cs
index 961d58eb6..9dc8d94e2 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -476,7 +476,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
return 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.cs
index daa5b86d9..a756f4aa8 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