| 4144 | } |
| 4145 | |
| 4146 | static void |
| 4147 | start_new_log(signal_user_data_t *ud, GhbValue *uiDict) |
| 4148 | { |
| 4149 | time_t _now; |
| 4150 | struct tm *now; |
| 4151 | gchar *log_path, *pos, *basename, *dest_dir; |
| 4152 | const gchar *destname; |
| 4153 | |
| 4154 | // queue_activity_buffer is about to be reused, make sure |
| 4155 | // queue is showing the correct buffer |
| 4156 | ghb_queue_select_log(ud); |
| 4157 | // Erase current contents of queue activity |
| 4158 | gtk_text_buffer_set_text(ud->queue_activity_buffer, "", 0); |
| 4159 | |
| 4160 | _now = time(NULL); |
| 4161 | now = localtime(&_now); |
| 4162 | destname = ghb_dict_get_string(uiDict, "destination"); |
| 4163 | basename = g_path_get_basename(destname); |
| 4164 | if (ghb_dict_get_bool(ud->prefs, "EncodeLogLocation")) |
| 4165 | { |
| 4166 | dest_dir = g_path_get_dirname (destname); |
| 4167 | } |
| 4168 | else |
| 4169 | { |
| 4170 | dest_dir = ghb_get_user_config_dir("EncodeLogs"); |
| 4171 | } |
| 4172 | pos = g_strrstr( basename, "." ); |
| 4173 | if (pos != NULL) |
| 4174 | { |
| 4175 | *pos = 0; |
| 4176 | } |
| 4177 | log_path = g_strdup_printf("%s/%s %d-%02d-%02d %02d-%02d-%02d.log", |
| 4178 | dest_dir, |
| 4179 | basename, |
| 4180 | now->tm_year + 1900, now->tm_mon + 1, now->tm_mday, |
| 4181 | now->tm_hour, now->tm_min, now->tm_sec); |
| 4182 | g_free(basename); |
| 4183 | g_free(dest_dir); |
| 4184 | if (ud->job_activity_log) |
| 4185 | g_io_channel_unref(ud->job_activity_log); |
| 4186 | ud->job_activity_log = g_io_channel_new_file (log_path, "w", NULL); |
| 4187 | if (ud->job_activity_log) |
| 4188 | { |
| 4189 | gchar *ver_str; |
| 4190 | |
| 4191 | ver_str = g_strdup_printf("Handbrake Version: %s (%d)\n", |
| 4192 | hb_get_version(NULL), hb_get_build(NULL)); |
| 4193 | g_io_channel_write_chars (ud->job_activity_log, ver_str, |
| 4194 | -1, NULL, NULL); |
| 4195 | g_free(ver_str); |
| 4196 | ghb_dict_set_string(uiDict, "ActivityFilename", log_path); |
| 4197 | } |
| 4198 | g_free(log_path); |
| 4199 | } |
| 4200 | |
| 4201 | static void |
| 4202 | submit_job(signal_user_data_t *ud, GhbValue *queueDict) |
no test coverage detected