summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-08-07 21:31:14 +0000
committersr55 <[email protected]>2011-08-07 21:31:14 +0000
commit69d24d74273fde9bb4c790755c95575b4e6c3c0c (patch)
treea90422cd4aec2fc313af7eb8815e95bf6343abbc /win/CS/HandBrake.ApplicationServices/Services/Encode.cs
parentdb6a78037d052a0e0b2236bafef2799781930ce7 (diff)
WinGui: Change the Queue to work in the same way as the Mac/Lin Queue. Retain Completed jobs and mark them as such.
- Added option to clear completed jobs. - Added option to re-encode a completed/errored job. - In-progress/Waiting jobs get saved into queue recovery. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4161 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services/Encode.cs')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode.cs19
1 files changed, 14 insertions, 5 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
index 26708434f..953831732 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
@@ -40,6 +40,11 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
private DateTime startTime;
+ /// <summary>
+ /// The Current Task
+ /// </summary>
+ private QueueTask currentTask;
+
#endregion
/// <summary>
@@ -75,7 +80,7 @@ namespace HandBrake.ApplicationServices.Services
{
try
{
- QueueTask queueTask = encodeQueueTask;
+ this.currentTask = encodeQueueTask;
if (this.IsEncoding)
{
@@ -88,7 +93,7 @@ namespace HandBrake.ApplicationServices.Services
{
try
{
- this.SetupLogging(queueTask);
+ this.SetupLogging(currentTask);
}
catch (Exception)
{
@@ -103,10 +108,10 @@ namespace HandBrake.ApplicationServices.Services
}
// Make sure the path exists, attempt to create it if it doesn't
- this.VerifyEncodeDestinationPath(queueTask);
+ this.VerifyEncodeDestinationPath(currentTask);
string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");
- ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, queueTask.Query)
+ ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, currentTask.Query)
{
RedirectStandardOutput = true,
RedirectStandardError = enableLogging ? true : false,
@@ -164,7 +169,10 @@ namespace HandBrake.ApplicationServices.Services
}
catch (Exception exc)
{
- this.Invoke_encodeCompleted(new EncodeCompletedEventArgs(false, exc, "An Error occured when trying to encode this source. "));
+ TimeSpan time = DateTime.Now.Subtract(this.currentTask.StartTime);
+ this.Invoke_encodeCompleted(
+ new EncodeCompletedEventArgs(
+ false, exc, "An Error occured when trying to encode this source. "));
}
}
@@ -266,6 +274,7 @@ namespace HandBrake.ApplicationServices.Services
// This exception doesn't warrent user interaction, but it should be logged (TODO)
}
+ this.currentTask.Status = QueueItemStatus.Completed;
this.Invoke_encodeCompleted(new EncodeCompletedEventArgs(true, null, string.Empty));
}