| 207 | } |
| 208 | |
| 209 | gboolean |
| 210 | ghb_add_title_to_queue (signal_user_data_t *ud, GhbValue *settings, gint batch) |
| 211 | { |
| 212 | // Add settings to the queue |
| 213 | if (!validate_settings(ud, settings, batch)) |
| 214 | { |
| 215 | return FALSE; |
| 216 | } |
| 217 | |
| 218 | if (ud->queue == NULL) |
| 219 | ud->queue = ghb_array_new(); |
| 220 | |
| 221 | ghb_finalize_job(settings); |
| 222 | |
| 223 | GhbValue *titleDict = ghb_get_title_settings(settings); |
| 224 | GhbValue *jobDict = ghb_get_job_settings(settings); |
| 225 | GhbValue *destDict = ghb_get_job_dest_settings(settings); |
| 226 | GhbValue *uiDict = ghb_value_dup(settings); |
| 227 | |
| 228 | if (ghb_dict_get_string(destDict, "File") == NULL) |
| 229 | { |
| 230 | const char *dest = ghb_dict_get_string(uiDict, "destination"); |
| 231 | ghb_dict_set_string(destDict, "File", dest); |
| 232 | } |
| 233 | |
| 234 | ghb_dict_remove(uiDict, "Job"); |
| 235 | ghb_dict_remove(uiDict, "Title"); |
| 236 | |
| 237 | GhbValue *queueDict = ghb_dict_new(); |
| 238 | ghb_dict_set(queueDict, "uiSettings", uiDict); |
| 239 | ghb_dict_set(queueDict, "Job", ghb_value_dup(jobDict)); |
| 240 | ghb_dict_set(queueDict, "Title", ghb_value_dup(titleDict)); |
| 241 | |
| 242 | // Copy current prefs into settings |
| 243 | // The job should run with the preferences that existed |
| 244 | // when the job was added to the queue. |
| 245 | ghb_dict_set(uiDict, "Preferences", ghb_value_dup(ud->prefs)); |
| 246 | |
| 247 | // Make a copy of current settings to be used for the new job |
| 248 | ghb_dict_set_int(uiDict, "job_status", GHB_QUEUE_PENDING); |
| 249 | ghb_dict_set_int(uiDict, "job_unique_id", 0); |
| 250 | |
| 251 | ghb_array_append(ud->queue, queueDict); |
| 252 | ghb_add_to_queue_list(ud, queueDict); |
| 253 | ghb_save_queue(ud->queue); |
| 254 | ghb_update_pending(ud); |
| 255 | ghb_queue_buttons_grey(ud); |
| 256 | |
| 257 | return TRUE; |
| 258 | } |
| 259 | |
| 260 | static gboolean |
| 261 | title_destination_is_unique (GhbValue *settings_array, gint index) |
no test coverage detected