+ if (title.Duration.TotalMinutes > min && title.Duration.TotalMinutes < max)\r
+ {\r
+ // Add to Queue\r
+ this.drp_dvdtitle.SelectedItem = title;\r
+\r
+ if (!this.AddItemToQueue(false))\r
+ {\r
+ errors = true;\r
+ }\r
+ }\r
+ }\r
+\r
+ if (errors)\r
+ {\r
+ MessageBox.Show(\r
+ "One or more items could not be added to the queue. You should check your queue and manually add any missing jobs.",\r
+ "Warning",\r
+ MessageBoxButtons.OK,\r
+ MessageBoxIcon.Warning);\r
+ }\r
+ }\r
+ }\r
+\r
+ private bool AddItemToQueue(bool showError)\r
+ {\r
+ string query = QueryGenerator.GenerateFullQuery(this);\r
+ if (!string.IsNullOrEmpty(rtf_query.Text))\r
+ query = rtf_query.Text;\r
+\r
+ // If we have a custom query, then we'll want to figure out what the new source and destination is, otherwise we'll just use the gui components.\r
+ string jobSourcePath = !string.IsNullOrEmpty(rtf_query.Text) ? Main.GetSourceFromQuery(rtf_query.Text) : sourcePath;\r
+ string jobDestination = !string.IsNullOrEmpty(rtf_query.Text) ? Main.GetDestinationFromQuery(rtf_query.Text) : text_destination.Text;\r
+\r
+ // Make sure we have a Source and Destination.\r
+ if (string.IsNullOrEmpty(jobSourcePath) || string.IsNullOrEmpty(jobDestination))\r
+ {\r
+ if (showError)\r
+ MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ return false;\r
+ }\r
+\r
+ // Make sure the destination path exists.\r
+ if (!Directory.Exists(Path.GetDirectoryName(jobDestination)))\r
+ {\r
+ if (showError)\r
+ MessageBox.Show(string.Format("Destination Path does not exist.\nPath: {0}\n\nThis item was not added to the Queue.", Path.GetDirectoryName(jobDestination)), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ return false;\r
+ }\r
+\r
+ // Make sure we don't have a duplciate on the queue.\r
+ if (encodeQueue.CheckForDestinationDuplicate(jobDestination))\r
+ {\r
+ if (showError)\r
+ {\r
+ DialogResult result;\r
+ result =\r