diff options
author | jstebbins <[email protected]> | 2008-10-31 18:03:24 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2008-10-31 18:03:24 +0000 |
commit | 2ff0ad590ea9f4c559ecbcf24282d8d9559aa61d (patch) | |
tree | 7c819886d472bcf6a09b2b2cc0bf639ba3bdcf32 /gtk | |
parent | 71d5ee949240506a1aab5cfe2c71dada1c17cb39 (diff) |
LinGui: Activity Logs for individual encodes
- Individual activity logs are saved in the file format
"YYYY-MM-DD HH-MM-SS mymoviename.log".
- Default directory is <user config idr>/ghb/EncodeLogs
(usually ~/.config/ghb/EncodeLogs)
- Preference available to alternatively put them in the users output
movie directory with the output movie (by default set to "off").
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1887 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/callbacks.c | 58 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 20 | ||||
-rw-r--r-- | gtk/src/internal_defaults.xml | 2 | ||||
-rw-r--r-- | gtk/src/main.c | 3 | ||||
-rw-r--r-- | gtk/src/presets.c | 25 | ||||
-rw-r--r-- | gtk/src/presets.h | 2 | ||||
-rw-r--r-- | gtk/src/resource_data.h | 31 | ||||
-rw-r--r-- | gtk/src/resources.plist | 22 | ||||
-rw-r--r-- | gtk/src/settings.h | 1 |
9 files changed, 147 insertions, 17 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 7e22de3ce..f79fbe24e 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -1423,10 +1423,52 @@ submit_job(GValue *settings) } static void -queue_scan(GValue *js) +queue_scan(signal_user_data_t *ud, GValue *js) { gchar *path; gint titlenum; + time_t _now; + struct tm *now; + gchar *log_path, *pos, *destname, *basename, *dest_dir; + + _now = time(NULL); + now = localtime(&_now); + destname = ghb_settings_get_string(js, "destination"); + basename = g_path_get_basename(destname); + if (ghb_settings_get_boolean(ud->settings, "EncodeLogLocation")) + { + dest_dir = g_path_get_dirname (destname); + } + else + { + dest_dir = ghb_get_user_config_dir("EncodeLogs"); + } + g_free(destname); + pos = g_strrstr( basename, "." ); + if (pos != NULL) + { + *pos = 0; + } + log_path = g_strdup_printf("%s/%d-%02d-%02d %02d-%02d-%02d %s.log", + dest_dir, + now->tm_year + 1900, now->tm_mon + 1, now->tm_mday, + now->tm_hour, now->tm_min, now->tm_sec, basename); + g_free(basename); + g_free(dest_dir); + if (ud->job_activity_log) + g_io_channel_unref(ud->job_activity_log); + ud->job_activity_log = g_io_channel_new_file (log_path, "w", NULL); + if (ud->job_activity_log) + { + gchar *ver_str; + + ver_str = g_strdup_printf("Handbrake Version: %s (%d)\n", + HB_VERSION, HB_BUILD); + g_io_channel_write_chars (ud->job_activity_log, ver_str, + -1, NULL, NULL); + g_free(ver_str); + } + g_free(log_path); path = ghb_settings_get_string( js, "source"); titlenum = ghb_settings_get_int(js, "titlenum"); @@ -1455,7 +1497,7 @@ ghb_start_next_job(signal_user_data_t *ud, gboolean find_first) if (status == GHB_QUEUE_PENDING) { current = ii; - queue_scan(js); + queue_scan(ud, js); return js; } } @@ -1476,7 +1518,7 @@ ghb_start_next_job(signal_user_data_t *ud, gboolean find_first) if (status == GHB_QUEUE_PENDING) { current = jj; - queue_scan(js); + queue_scan(ud, js); return js; } } @@ -1491,7 +1533,7 @@ ghb_start_next_job(signal_user_data_t *ud, gboolean find_first) if (status == GHB_QUEUE_PENDING) { current = ii; - queue_scan(js); + queue_scan(ud, js); return js; } } @@ -1737,6 +1779,8 @@ ghb_backend_events(signal_user_data_t *ud) ghb_settings_set_int(js, "job_status", qstatus); ghb_save_queue(ud->queue); ud->cancel_encode = FALSE; + g_io_channel_unref(ud->job_activity_log); + ud->job_activity_log = NULL; } else if (status.queue_state & GHB_STATE_MUXING) { @@ -1870,7 +1914,11 @@ ghb_log_cb(GIOChannel *source, GIOCondition cond, gpointer data) mark = gtk_text_buffer_get_insert (buffer); gtk_text_view_scroll_mark_onscreen(textview, mark); } - g_io_channel_write_chars (ud->activity_log, text, length, &length, NULL); + g_io_channel_write_chars (ud->activity_log, text, + length, &length, NULL); + if (ud->job_activity_log) + g_io_channel_write_chars (ud->job_activity_log, text, + length, &length, NULL); g_free(text); } if (status != G_IO_STATUS_NORMAL) diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 0f8baf833..67ed63d7a 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -3472,6 +3472,22 @@ this setting.</property> </packing> </child> <child> + <object class="GtkCheckButton" id="EncodeLogLocation"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text"> HandBrake produces 2 activity logs. +One for the session and one for each encoding. +Store the individual encode logs in the same +location as the movie.</property> + <property name="label" translatable="yes">Store logs in destination video directory</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="pref_changed_cb"/> + </object> + <packing> + <property name="position">5</property> + </packing> + </child> + <child> <object class="GtkCheckButton" id="allow_tweaks"> <property name="can_focus">True</property> <property name="label" translatable="yes">Allow Tweaks</property> @@ -3479,7 +3495,7 @@ this setting.</property> <signal name="toggled" handler="tweaks_changed_cb"/> </object> <packing> - <property name="position">5</property> + <property name="position">6</property> </packing> </child> <child> @@ -3490,7 +3506,7 @@ this setting.</property> <signal name="toggled" handler="hbfd_feature_changed_cb"/> </object> <packing> - <property name="position">6</property> + <property name="position">7</property> </packing> </child> </object> diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml index 282000051..373f78a97 100644 --- a/gtk/src/internal_defaults.xml +++ b/gtk/src/internal_defaults.xml @@ -84,6 +84,8 @@ </dict> <key>Preferences</key> <dict> + <key>EncodeLogLocation</key> + <false /> <key>allow_tweaks</key> <false /> <key>chapters_in_destination</key> diff --git a/gtk/src/main.c b/gtk/src/main.c index d1a002a11..d73538473 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -420,9 +420,10 @@ IoRedirect(signal_user_data_t *ud) } // Open activity log. // TODO: Put this in the same directory as the encode destination - config = ghb_get_user_config_dir(); + config = ghb_get_user_config_dir(NULL); path = g_strdup_printf("%s/%s", config, "Activity.log"); ud->activity_log = g_io_channel_new_file (path, "w", NULL); + ud->job_activity_log = NULL; ghb_ui_update(ud, "activity_location", ghb_string_value(path)); g_free(path); g_free(config); diff --git a/gtk/src/presets.c b/gtk/src/presets.c index cad74d74d..0e40e6dcc 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -1015,7 +1015,7 @@ ghb_select_default_preset(GtkBuilder *builder) } gchar* -ghb_get_user_config_dir() +ghb_get_user_config_dir(gchar *subdir) { const gchar *dir; gchar *config; @@ -1034,6 +1034,23 @@ ghb_get_user_config_dir() if (!g_file_test(config, G_FILE_TEST_IS_DIR)) g_mkdir (config, 0755); } + if (subdir) + { + gchar **split; + gint ii; + + split = g_strsplit(subdir, "/", -1); + for (ii = 0; split[ii] != NULL; ii++) + { + gchar *tmp; + + tmp = g_strdup_printf ("%s/%s", config, split[ii]); + g_free(config); + config = tmp; + if (!g_file_test(config, G_FILE_TEST_IS_DIR)) + g_mkdir (config, 0755); + } + } return config; } @@ -1043,7 +1060,7 @@ store_plist(GValue *plist, const gchar *name) gchar *config, *path; FILE *file; - config = ghb_get_user_config_dir(); + config = ghb_get_user_config_dir(NULL); path = g_strdup_printf ("%s/%s", config, name); file = g_fopen(path, "w"); g_free(config); @@ -1058,7 +1075,7 @@ load_plist(const gchar *name) gchar *config, *path; GValue *plist = NULL; - config = ghb_get_user_config_dir(); + config = ghb_get_user_config_dir(NULL); path = g_strdup_printf ("%s/%s", config, name); if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) { @@ -1074,7 +1091,7 @@ remove_plist(const gchar *name) { gchar *config, *path; - config = ghb_get_user_config_dir(); + config = ghb_get_user_config_dir(NULL); path = g_strdup_printf ("%s/%s", config, name); if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) { diff --git a/gtk/src/presets.h b/gtk/src/presets.h index 156523806..c5a870d3d 100644 --- a/gtk/src/presets.h +++ b/gtk/src/presets.h @@ -28,7 +28,7 @@ void ghb_pref_save(GValue *settings, const gchar *key); void ghb_save_queue(GValue *queue); GValue* ghb_load_queue(); void ghb_remove_queue_file(void);; -gchar* ghb_get_user_config_dir(); +gchar* ghb_get_user_config_dir(gchar *subdir); void ghb_settings_to_ui(signal_user_data_t *ud, GValue *dict); void ghb_clear_presets_selection(signal_user_data_t *ud); void ghb_select_preset(GtkBuilder *builder, diff --git a/gtk/src/resource_data.h b/gtk/src/resource_data.h index f962b7810..b942f67e5 100644 --- a/gtk/src/resource_data.h +++ b/gtk/src/resource_data.h @@ -5696,6 +5696,31 @@ " </child>\n" " <child>\n" " <object class="GtkCheckButton" i" +"d="EncodeLogLocation">\n" +" <property name="visible">Tr" +"ue</property>\n" +" <property name="can_focus">" +"True</property>\n" +" <property name="tooltip_text"&" +"gt; HandBrake produces 2 activity logs. \n" +"One for the session and one for each encoding.\n" +"Store the individual encode logs in the same\n" +"location as the movie.</property>\n" +" <property name="label" transla" +"table="yes">Store logs in destination video directory</" +"property>\n" +" <property name="draw_indicator"" +";>True</property>\n" +" <signal name="toggled" handler" +"="pref_changed_cb"/>\n" +" </object>\n" +" <packing>\n" +" <property name="position">5" +"</property>\n" +" </packing>\n" +" </child>\n" +" <child>\n" +" <object class="GtkCheckButton" i" "d="allow_tweaks">\n" " <property name="can_focus">" "True</property>\n" @@ -5707,7 +5732,7 @@ "="tweaks_changed_cb"/>\n" " </object>\n" " <packing>\n" -" <property name="position">5" +" <property name="position">6" "</property>\n" " </packing>\n" " </child>\n" @@ -5724,7 +5749,7 @@ "="hbfd_feature_changed_cb"/>\n" " </object>\n" " <packing>\n" -" <property name="position">6" +" <property name="position">7" "</property>\n" " </packing>\n" " </child>\n" @@ -10122,6 +10147,8 @@ " </dict>\n" " <key>Preferences</key>\n" " <dict>\n" +" <key>EncodeLogLocation</key>\n" +" <false />\n" " <key>allow_tweaks</key>\n" " <false />\n" " <key>chapters_in_destination</key>\n" diff --git a/gtk/src/resources.plist b/gtk/src/resources.plist index 2fa3c29a0..d286994bd 100644 --- a/gtk/src/resources.plist +++ b/gtk/src/resources.plist @@ -3477,6 +3477,22 @@ this setting.</property> </packing> </child> <child> + <object class="GtkCheckButton" id="EncodeLogLocation"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text"> HandBrake produces 2 activity logs. +One for the session and one for each encoding. +Store the individual encode logs in the same +location as the movie.</property> + <property name="label" translatable="yes">Store logs in destination video directory</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="pref_changed_cb"/> + </object> + <packing> + <property name="position">5</property> + </packing> + </child> + <child> <object class="GtkCheckButton" id="allow_tweaks"> <property name="can_focus">True</property> <property name="label" translatable="yes">Allow Tweaks</property> @@ -3484,7 +3500,7 @@ this setting.</property> <signal name="toggled" handler="tweaks_changed_cb"/> </object> <packing> - <property name="position">5</property> + <property name="position">6</property> </packing> </child> <child> @@ -3495,7 +3511,7 @@ this setting.</property> <signal name="toggled" handler="hbfd_feature_changed_cb"/> </object> <packing> - <property name="position">6</property> + <property name="position">7</property> </packing> </child> </object> @@ -4930,6 +4946,8 @@ R2RrUAAABBgBAQACAAAAQAAAABAAAAAQ////AP///wD///8A////AP///wD///8A////AP///wD///8A </dict> <key>Preferences</key> <dict> + <key>EncodeLogLocation</key> + <false /> <key>allow_tweaks</key> <false /> <key>chapters_in_destination</key> diff --git a/gtk/src/settings.h b/gtk/src/settings.h index b78879939..a089e0a71 100644 --- a/gtk/src/settings.h +++ b/gtk/src/settings.h @@ -47,6 +47,7 @@ typedef struct GValue *queue; GValue *current_job; GIOChannel *activity_log; + GIOChannel *job_activity_log; } signal_user_data_t; enum |