update sync progress display
This commit is contained in:
parent
713083b34a
commit
e76e8bb96c
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -476,7 +476,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
|
||||
return new StreamWriter(stream, contentType, _logger)
|
||||
{
|
||||
OnComplete = options.OnComplete
|
||||
OnComplete = options.OnComplete,
|
||||
OnError = options.OnError
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user