diff options
Diffstat (limited to 'win/C#/HandBrake.ApplicationServices')
4 files changed, 24 insertions, 21 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs index 90c224ac4..e2046da91 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs @@ -288,10 +288,6 @@ namespace HandBrake.ApplicationServices.Services //}*/
}
- #endregion
-
- #region Private Helper Methods
-
/// <summary>
/// Save a copy of the log to the users desired location or a default location
/// if this feature is enabled in options.
@@ -299,7 +295,7 @@ namespace HandBrake.ApplicationServices.Services /// <param name="destination">
/// The Destination File Path
/// </param>
- protected void CopyLog(string destination)
+ public void ProcessLogs(string destination)
{
try
{
@@ -334,6 +330,10 @@ namespace HandBrake.ApplicationServices.Services }
}
+ #endregion
+
+ #region Private Helper Methods
+
/// <summary>
/// The HandBrakeCLI process has exited.
/// </summary>
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs b/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs index 399afdec7..7ba739617 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs @@ -84,5 +84,13 @@ namespace HandBrake.ApplicationServices.Services.Interfaces /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html
/// </summary>
void SafelyStop();
+
+ /// <summary>
+ /// Copy the log file to the desired destinations
+ /// </summary>
+ /// <param name="destination">
+ /// The destination.
+ /// </param>
+ void ProcessLogs(string destination);
}
}
\ No newline at end of file diff --git a/win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs b/win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs index 05602f13d..5edbf39b0 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/QueueManager.cs @@ -21,19 +21,12 @@ {
/*
* TODO
- * - Multi HandBrake Instance Support for Queue Saving.
* - Rewrite the batch script generator.
*/
#region Private Variables
/// <summary>
- /// HandBrakes Queue file with a place holder for an extra string.
- /// Use this with String.Format()
- /// </summary>
- private const string QueueFile = "hb_queue_recovery{0}.xml";
-
- /// <summary>
/// A Lock object to maintain thread safety
/// </summary>
static readonly object QueueLock = new object();
@@ -44,6 +37,11 @@ private readonly List<QueueTask> queue = new List<QueueTask>();
/// <summary>
+ /// HandBrakes Queue file with a place holder for an extra string.
+ /// </summary>
+ private readonly string queueFile;
+
+ /// <summary>
/// The ID of the job last added
/// </summary>
private int lastJobId;
@@ -64,6 +62,9 @@ public QueueManager(int instanceId)
{
this.instanceId = instanceId;
+
+ // If this is the first instance, just use the main queue file, otherwise add the instance id to the filename.
+ this.queueFile = instanceId == 0 ? "hb_queue_recovery.xml" : string.Format("hb_queue_recovery{0}.xml", instanceId);
}
#region Events
@@ -233,7 +234,7 @@ public void BackupQueue(string exportPath)
{
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");
- string tempPath = !string.IsNullOrEmpty(exportPath) ? exportPath : appDataPath + string.Format(QueueFile, string.Empty);
+ string tempPath = !string.IsNullOrEmpty(exportPath) ? exportPath : appDataPath + string.Format(this.queueFile, string.Empty);
if (File.Exists(tempPath))
{
@@ -256,7 +257,7 @@ public void RestoreQueue(string importPath)
{
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\");
- string tempPath = !string.IsNullOrEmpty(importPath) ? importPath : (appDataPath + string.Format(QueueFile, string.Empty));
+ string tempPath = !string.IsNullOrEmpty(importPath) ? importPath : (appDataPath + string.Format(this.queueFile, string.Empty));
if (File.Exists(tempPath))
{
diff --git a/win/C#/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/C#/HandBrake.ApplicationServices/Services/QueueProcessor.cs index d49d4379a..162527164 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/QueueProcessor.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/QueueProcessor.cs @@ -19,12 +19,6 @@ namespace HandBrake.ApplicationServices.Services /// </summary>
public class QueueProcessor : IQueueProcessor
{
- /*
- * TODO
- * - Hookup the logging to write to disk
- *
- */
-
/// <summary>
/// Initializes a new instance of the <see cref="QueueProcessor"/> class.
/// </summary>
@@ -204,7 +198,7 @@ namespace HandBrake.ApplicationServices.Services "Put down that cocktail...\nyour Handbrake encode is done.");
// Handling Log Data
- // TODO - Still need to re-write this using CopyLog()
+ this.EncodeService.ProcessLogs(this.QueueManager.LastProcessedJob.Destination);
// Move onto the next job.
this.ProcessNextJob();
|