/// <param name="query">The query that will be passed to the HandBrake CLI.</param>\r
/// <param name="source">The location of the source video.</param>\r
/// <param name="destination">The location where the encoded video will be.</param>\r
- public void AddJob(string query, string source, string destination)\r
+ /// <param name="customJob"></param>\r
+ public void AddJob(string query, string source, string destination, bool customJob)\r
{\r
- Job newJob = new Job { Id = nextJobId++, Query = query, Source = source, Destination = destination };\r
+ Job newJob = new Job { Id = nextJobId++, Query = query, Source = source, Destination = destination, CustomQuery = customJob };\r
\r
queue.Add(newJob);\r
WriteQueueStateToFile("hb_queue_recovery.xml");\r
// Run through each item on the queue\r
while (this.Count != 0)\r
{\r
- string query = GetNextJob().Query;\r
+ Job encJob = GetNextJob();\r
+ string query = encJob.Query;\r
WriteQueueStateToFile("hb_queue_recovery.xml"); // Update the queue recovery file\r
\r
RunCli(query);\r
\r
hbProcess.WaitForExit();\r
\r
- AddCLIQueryToLog(query);\r
+ AddCLIQueryToLog(encJob);\r
CopyLog(LastEncode.Destination);\r
\r
hbProcess.Close();\r
/// Append the CLI query to the start of the log file.\r
/// </summary>\r
/// <param name="query"></param>\r
- private static void AddCLIQueryToLog(string query)\r
+ private static void AddCLIQueryToLog(Job encJob)\r
{\r
string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
string logPath = Path.Combine(logDir, "last_encode_log.txt");\r
\r
StreamWriter writer = new StreamWriter(File.Create(logPath));\r
\r
- writer.Write("### CLI Query: " + query + "\n\n");\r
+ writer.Write("### CLI Query: " + encJob.Query + "\n\n");\r
+ writer.Write("### User Query: " + encJob.CustomQuery + "\n\n");\r
writer.Write("#########################################\n\n");\r
writer.WriteLine(log);\r
writer.Flush();\r
Homepage: <http://handbrake.fr>.\r
It may be used under the terms of the GNU General Public License. */\r
\r
+using System;\r
+\r
namespace Handbrake.EncodeQueue\r
{\r
public struct Job\r
public string Query { get; set; }\r
\r
/// <summary>\r
+ /// record if this is a user or GUI generated query\r
+ /// </summary>\r
+ public Boolean CustomQuery { get; set; }\r
+\r
+ /// <summary>\r
/// Gets or sets the source file of encoding.\r
/// </summary>\r
public string Source { get; set; }\r
rtf_actLog.AppendText(String.Format("### Install Dir: {0} \n", Application.StartupPath));\r
rtf_actLog.AppendText(String.Format("### Data Dir: {0} \n", Application.UserAppDataPath));\r
rtf_actLog.AppendText("#########################################\n\n");\r
- if ((!_encodeQueue.LastEncode.IsEmpty) && _encodeQueue.LastEncode.Query != String.Empty)\r
- {\r
- rtf_actLog.AppendText("### CLI Query: " + _encodeQueue.LastEncode.Query + "\n\n");\r
- rtf_actLog.AppendText("#########################################\n\n");\r
- }\r
\r
// Seutp the log file\r
if (scan)\r
{\r
_readFile = "last_encode_log.txt";\r
txt_log.Text = "Encode Log";\r
+ if (_encodeQueue.isEncoding)\r
+ if ((!_encodeQueue.LastEncode.IsEmpty) && _encodeQueue.LastEncode.Query != String.Empty)\r
+ {\r
+ rtf_actLog.AppendText("### CLI Query: " + _encodeQueue.LastEncode.Query + "\n");\r
+ rtf_actLog.AppendText("### Custom Query: " + _encodeQueue.LastEncode.CustomQuery + "\n\n");\r
+ rtf_actLog.AppendText("#########################################\n\n");\r
+ }\r
}\r
_lastUpdate = false;\r
}\r
fileNotFoundQuickFix = true;\r
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;\r
}\r
- \r
+\r
StreamReader sr = new StreamReader(logFile2);\r
string line;\r
int i = 1;\r
if (overwrite == DialogResult.Yes)\r
{\r
if (encodeQueue.Count == 0)\r
- encodeQueue.AddJob(query, sourcePath, text_destination.Text);\r
+ encodeQueue.AddJob(query, sourcePath, text_destination.Text, (rtf_query.Text != ""));\r
\r
queueWindow.setQueue();\r
if (encodeQueue.Count > 1)\r
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?",\r
"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);\r
if (result == DialogResult.Yes)\r
- encodeQueue.AddJob(query, sourcePath, text_destination.Text);\r
+ encodeQueue.AddJob(query, sourcePath, text_destination.Text, (rtf_query.Text != ""));\r
\r
}\r
else\r
- encodeQueue.AddJob(query, sourcePath, text_destination.Text);\r
+ encodeQueue.AddJob(query, sourcePath, text_destination.Text, (rtf_query.Text != ""));\r
\r
lbl_encode.Text = encodeQueue.Count + " encode(s) pending in the queue";\r
\r
if (ActivityWindow == null)\r
ActivityWindow = new frmActivityWindow(file, encodeQueue, this);\r
\r
+ ActivityWindow.SetLogView(!encodeQueue.isEncoding);\r
+\r
ActivityWindow.Show();\r
}\r
#endregion\r
{\r
if (!queue.LastEncode.IsEmpty)\r
{\r
- queue.AddJob(queue.LastEncode.Query, queue.LastEncode.Source, queue.LastEncode.Destination);\r
+ queue.AddJob(queue.LastEncode.Query, queue.LastEncode.Source, queue.LastEncode.Destination, queue.LastEncode.CustomQuery);\r
updateUIElements();\r
}\r
}\r