From c3c5892ff08f931b0043d8c26e41b57f73f26205 Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 14 Jun 2012 19:22:31 +0000 Subject: WinGui: Fix build and further clean out some legacy code. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4735 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Model/EncodeTask.cs | 16 +++++++++++ .../Model/QueueTask.cs | 31 ---------------------- .../Services/Base/EncodeBase.cs | 5 ++-- .../Services/Encode.cs | 12 ++++++++- .../Services/QueueManager.cs | 3 ++- 5 files changed, 32 insertions(+), 35 deletions(-) (limited to 'win/CS/HandBrake.ApplicationServices') diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index 6ed3bf2e1..cdd436b03 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -460,6 +460,7 @@ namespace HandBrake.ApplicationServices.Model /// Gets or sets Duration. /// public int? PreviewDuration { get; set; } + #endregion #region Helpers @@ -484,6 +485,21 @@ namespace HandBrake.ApplicationServices.Model return false; } } + + /// + /// Gets or sets a value indicating whether IsPreviewEncode. + /// + public bool IsPreviewEncode { get; set; } + + /// + /// Gets or sets PreviewEncodeDuration. + /// + public int PreviewEncodeDuration { get; set; } + + /// + /// Gets or sets PreviewEncodeStartAt. + /// + public string PreviewEncodeStartAt { get; set; } #endregion } } diff --git a/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs b/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs index a62115109..0e06ca5c6 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs @@ -25,32 +25,6 @@ namespace HandBrake.ApplicationServices.Model #endregion - #region Constructors and Destructors - - /// - /// Initializes a new instance of the class. - /// - public QueueTask() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - /// The query. - /// - public QueueTask(string query) - { - this.Query = query; - if (this.Task == null) - { - this.Task = new EncodeTask(); - } - } - - #endregion - #region Properties /// @@ -58,11 +32,6 @@ namespace HandBrake.ApplicationServices.Model /// public bool CustomQuery { get; set; } - /// - /// Gets or sets the query string. - /// - public string Query { get; set; } - /// /// Gets or sets Status. /// diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs index 537a97d71..e04c4e830 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs @@ -257,8 +257,9 @@ namespace HandBrake.ApplicationServices.Services.Base try { + string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task)); this.logBuffer = new StringBuilder(); - this.logBuffer.AppendLine(String.Format("CLI Query: {0}", encodeQueueTask.Query)); + this.logBuffer.AppendLine(String.Format("CLI Query: {0}", query)); this.logBuffer.AppendLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery)); this.logBuffer.AppendLine(); @@ -275,7 +276,7 @@ namespace HandBrake.ApplicationServices.Services.Base this.fileWriter = new StreamWriter(logFile) { AutoFlush = true }; this.fileWriter.WriteLine(GeneralUtilities.CreateCliLogHeader()); - this.fileWriter.WriteLine(String.Format("CLI Query: {0}", encodeQueueTask.Query)); + this.fileWriter.WriteLine(String.Format("CLI Query: {0}", query)); this.fileWriter.WriteLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery)); this.fileWriter.WriteLine(); } diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs index 8c04d5a3b..7553456d5 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs @@ -21,6 +21,7 @@ namespace HandBrake.ApplicationServices.Services using HandBrake.ApplicationServices.Parsing; using HandBrake.ApplicationServices.Services.Base; using HandBrake.ApplicationServices.Services.Interfaces; + using HandBrake.ApplicationServices.Utilities; /// /// Class which handles the CLI @@ -120,7 +121,16 @@ namespace HandBrake.ApplicationServices.Services this.VerifyEncodeDestinationPath(currentTask); string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe"); - ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, currentTask.Query) + + // TODO tidy this code up, it's kinda messy. + string query = this.currentTask.Task.IsPreviewEncode + ? QueryGeneratorUtility.GeneratePreviewQuery( + new EncodeTask(this.currentTask.Task), + this.currentTask.Task.PreviewEncodeDuration, + this.currentTask.Task.PreviewEncodeStartAt) + : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task)); + + ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, query) { RedirectStandardOutput = true, RedirectStandardError = enableLogging ? true : false, diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs index 0d3a40e7f..8464ffed2 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs @@ -23,6 +23,7 @@ namespace HandBrake.ApplicationServices.Services using HandBrake.ApplicationServices.Exceptions; using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Services.Interfaces; + using HandBrake.ApplicationServices.Utilities; using EventArgs = System.EventArgs; @@ -392,7 +393,7 @@ namespace HandBrake.ApplicationServices.Services string queries = string.Empty; foreach (QueueTask queueItem in this.queue) { - string qItem = queueItem.Query; + string qItem = QueryGeneratorUtility.GenerateQuery(new EncodeTask(queueItem.Task)); string fullQuery = '"' + Application.StartupPath + "\\HandBrakeCLI.exe" + '"' + qItem; if (queries == string.Empty) -- cgit v1.2.3