summaryrefslogtreecommitdiffstats
path: root/win/C#
diff options
context:
space:
mode:
Diffstat (limited to 'win/C#')
-rw-r--r--win/C#/EncodeQueue/EncodeAndQueueHandler.cs15
-rw-r--r--win/C#/EncodeQueue/Job.cs7
-rw-r--r--win/C#/frmActivityWindow.cs14
-rw-r--r--win/C#/frmMain.cs8
-rw-r--r--win/C#/frmQueue.cs2
5 files changed, 30 insertions, 16 deletions
diff --git a/win/C#/EncodeQueue/EncodeAndQueueHandler.cs b/win/C#/EncodeQueue/EncodeAndQueueHandler.cs
index 93cab845a..f2a4eaedf 100644
--- a/win/C#/EncodeQueue/EncodeAndQueueHandler.cs
+++ b/win/C#/EncodeQueue/EncodeAndQueueHandler.cs
@@ -82,9 +82,10 @@ namespace Handbrake.EncodeQueue
/// <param name="query">The query that will be passed to the HandBrake CLI.</param>
/// <param name="source">The location of the source video.</param>
/// <param name="destination">The location where the encoded video will be.</param>
- public void AddJob(string query, string source, string destination)
+ /// <param name="customJob"></param>
+ public void AddJob(string query, string source, string destination, bool customJob)
{
- Job newJob = new Job { Id = nextJobId++, Query = query, Source = source, Destination = destination };
+ Job newJob = new Job { Id = nextJobId++, Query = query, Source = source, Destination = destination, CustomQuery = customJob };
queue.Add(newJob);
WriteQueueStateToFile("hb_queue_recovery.xml");
@@ -306,7 +307,8 @@ namespace Handbrake.EncodeQueue
// Run through each item on the queue
while (this.Count != 0)
{
- string query = GetNextJob().Query;
+ Job encJob = GetNextJob();
+ string query = encJob.Query;
WriteQueueStateToFile("hb_queue_recovery.xml"); // Update the queue recovery file
RunCli(query);
@@ -316,7 +318,7 @@ namespace Handbrake.EncodeQueue
hbProcess.WaitForExit();
- AddCLIQueryToLog(query);
+ AddCLIQueryToLog(encJob);
CopyLog(LastEncode.Destination);
hbProcess.Close();
@@ -469,7 +471,7 @@ namespace Handbrake.EncodeQueue
/// Append the CLI query to the start of the log file.
/// </summary>
/// <param name="query"></param>
- private static void AddCLIQueryToLog(string query)
+ private static void AddCLIQueryToLog(Job encJob)
{
string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
string logPath = Path.Combine(logDir, "last_encode_log.txt");
@@ -480,7 +482,8 @@ namespace Handbrake.EncodeQueue
StreamWriter writer = new StreamWriter(File.Create(logPath));
- writer.Write("### CLI Query: " + query + "\n\n");
+ writer.Write("### CLI Query: " + encJob.Query + "\n\n");
+ writer.Write("### User Query: " + encJob.CustomQuery + "\n\n");
writer.Write("#########################################\n\n");
writer.WriteLine(log);
writer.Flush();
diff --git a/win/C#/EncodeQueue/Job.cs b/win/C#/EncodeQueue/Job.cs
index e912fd65a..7dfe7e518 100644
--- a/win/C#/EncodeQueue/Job.cs
+++ b/win/C#/EncodeQueue/Job.cs
@@ -4,6 +4,8 @@
Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
+using System;
+
namespace Handbrake.EncodeQueue
{
public struct Job
@@ -19,6 +21,11 @@ namespace Handbrake.EncodeQueue
public string Query { get; set; }
/// <summary>
+ /// record if this is a user or GUI generated query
+ /// </summary>
+ public Boolean CustomQuery { get; set; }
+
+ /// <summary>
/// Gets or sets the source file of encoding.
/// </summary>
public string Source { get; set; }
diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs
index 9509500a6..9f9f41128 100644
--- a/win/C#/frmActivityWindow.cs
+++ b/win/C#/frmActivityWindow.cs
@@ -74,11 +74,6 @@ namespace Handbrake
rtf_actLog.AppendText(String.Format("### Install Dir: {0} \n", Application.StartupPath));
rtf_actLog.AppendText(String.Format("### Data Dir: {0} \n", Application.UserAppDataPath));
rtf_actLog.AppendText("#########################################\n\n");
- if ((!_encodeQueue.LastEncode.IsEmpty) && _encodeQueue.LastEncode.Query != String.Empty)
- {
- rtf_actLog.AppendText("### CLI Query: " + _encodeQueue.LastEncode.Query + "\n\n");
- rtf_actLog.AppendText("#########################################\n\n");
- }
// Seutp the log file
if (scan)
@@ -90,6 +85,13 @@ namespace Handbrake
{
_readFile = "last_encode_log.txt";
txt_log.Text = "Encode Log";
+ if (_encodeQueue.isEncoding)
+ if ((!_encodeQueue.LastEncode.IsEmpty) && _encodeQueue.LastEncode.Query != String.Empty)
+ {
+ rtf_actLog.AppendText("### CLI Query: " + _encodeQueue.LastEncode.Query + "\n");
+ rtf_actLog.AppendText("### Custom Query: " + _encodeQueue.LastEncode.CustomQuery + "\n\n");
+ rtf_actLog.AppendText("#########################################\n\n");
+ }
}
_lastUpdate = false;
}
@@ -184,7 +186,7 @@ namespace Handbrake
fileNotFoundQuickFix = true;
return "\n\n\nERROR: The log file could not be found. \nMaybe you cleared your system's tempory folder or maybe you just havn't run an encode yet. \nTried to find the log file in: " + logFile;
}
-
+
StreamReader sr = new StreamReader(logFile2);
string line;
int i = 1;
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 4e3a73ff9..2be9b168b 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -729,7 +729,7 @@ namespace Handbrake
if (overwrite == DialogResult.Yes)
{
if (encodeQueue.Count == 0)
- encodeQueue.AddJob(query, sourcePath, text_destination.Text);
+ encodeQueue.AddJob(query, sourcePath, text_destination.Text, (rtf_query.Text != ""));
queueWindow.setQueue();
if (encodeQueue.Count > 1)
@@ -764,11 +764,11 @@ namespace Handbrake
DialogResult result = MessageBox.Show("There is already a queue item for this destination path. \n\n If you continue, the encode will be overwritten. Do you wish to continue?",
"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
- encodeQueue.AddJob(query, sourcePath, text_destination.Text);
+ encodeQueue.AddJob(query, sourcePath, text_destination.Text, (rtf_query.Text != ""));
}
else
- encodeQueue.AddJob(query, sourcePath, text_destination.Text);
+ encodeQueue.AddJob(query, sourcePath, text_destination.Text, (rtf_query.Text != ""));
lbl_encode.Text = encodeQueue.Count + " encode(s) pending in the queue";
@@ -806,6 +806,8 @@ namespace Handbrake
if (ActivityWindow == null)
ActivityWindow = new frmActivityWindow(file, encodeQueue, this);
+ ActivityWindow.SetLogView(!encodeQueue.isEncoding);
+
ActivityWindow.Show();
}
#endregion
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index e110a470e..352978960 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -379,7 +379,7 @@ namespace Handbrake
{
if (!queue.LastEncode.IsEmpty)
{
- queue.AddJob(queue.LastEncode.Query, queue.LastEncode.Source, queue.LastEncode.Destination);
+ queue.AddJob(queue.LastEncode.Query, queue.LastEncode.Source, queue.LastEncode.Destination, queue.LastEncode.CustomQuery);
updateUIElements();
}
}