From 12def0ed27098092a7a998eaa29886770071a2b4 Mon Sep 17 00:00:00 2001 From: sr55 Date: Tue, 27 Jan 2015 21:23:57 +0000 Subject: WinGui: - Fixes to Disk logging. - Improvements to Queue Item tooltip. - Queue will no longer pause if an encode fails. It will move onto the next item and try that. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6822 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Services/Encode/EncodeBase.cs | 17 ++++++++++++----- .../Services/Encode/LibEncode.cs | 16 +++++++++++----- .../Services/QueueProcessor.cs | 4 ---- 3 files changed, 23 insertions(+), 14 deletions(-) (limited to 'win/CS/HandBrake.ApplicationServices') diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs index 3c78835ae..8737ba64f 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs @@ -10,6 +10,8 @@ namespace HandBrake.ApplicationServices.Services.Encode { using System; + using System.Collections.Generic; + using System.Diagnostics; using System.Globalization; using System.IO; using System.Text; @@ -344,7 +346,7 @@ namespace HandBrake.ApplicationServices.Services.Encode this.fileWriter.WriteLine(this.header); if (!isLibhb) { - this.fileWriter.WriteLine(string.Format("CLI Query: {0}", query)); + this.fileWriter.WriteLine("CLI Query: {0}", query); } this.fileWriter.WriteLine(); } @@ -353,8 +355,12 @@ namespace HandBrake.ApplicationServices.Services.Encode { if (this.fileWriter != null) { - this.fileWriter.Close(); - this.fileWriter.Dispose(); + lock (FileWriterLock) + { + this.fileWriter.Flush(); + this.fileWriter.Close(); + this.fileWriter.Dispose(); + } } throw; @@ -417,6 +423,7 @@ namespace HandBrake.ApplicationServices.Services.Encode { if (this.fileWriter != null) { + this.fileWriter.Flush(); this.fileWriter.Close(); this.fileWriter.Dispose(); } @@ -424,9 +431,9 @@ namespace HandBrake.ApplicationServices.Services.Encode this.fileWriter = null; } } - catch (Exception) + catch (Exception exc) { - // This exception doesn't warrent user interaction, but it should be logged (TODO) + Debug.WriteLine(exc); // This exception doesn't warrent user interaction, but it should be logged } } diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs index 6bc9ed884..208f8d307 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs @@ -343,15 +343,21 @@ namespace HandBrake.ApplicationServices.Services.Encode this.IsEncoding = false; ServiceLogMessage("Encode Completed ..."); - this.InvokeEncodeCompleted( - e.Error - ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Task.Destination) - : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Task.Destination)); - + // Stop Logging. HandBrakeUtils.MessageLogged -= this.HandBrakeInstanceMessageLogged; HandBrakeUtils.ErrorLogged -= this.HandBrakeInstanceErrorLogged; + + // Handling Log Data + this.ProcessLogs(this.currentTask.Task.Destination, this.currentTask.Configuration); + // Cleanup this.ShutdownFileWriter(); + + // Raise the Encode Completed EVent. + this.InvokeEncodeCompleted( + e.Error + ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Task.Destination) + : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Task.Destination)); } #endregion } diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs index ab1b4c2cb..991b2132e 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs @@ -488,12 +488,8 @@ namespace HandBrake.ApplicationServices.Services if (!e.Successful) { this.LastProcessedJob.Status = QueueItemStatus.Error; - this.Pause(); } - // Handling Log Data - this.EncodeService.ProcessLogs(this.LastProcessedJob.Task.Destination, this.LastProcessedJob.Configuration); - // Move onto the next job. if (this.IsProcessing) { -- cgit v1.2.3