}
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");
if (status == GHB_QUEUE_PENDING)
{
current = ii;
- queue_scan(js);
+ queue_scan(ud, js);
return js;
}
}
if (status == GHB_QUEUE_PENDING)
{
current = jj;
- queue_scan(js);
+ queue_scan(ud, js);
return js;
}
}
if (status == GHB_QUEUE_PENDING)
{
current = ii;
- queue_scan(js);
+ queue_scan(ud, js);
return js;
}
}
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)
{
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)
<property name="position">4</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>
<signal name="toggled" handler="tweaks_changed_cb"/>
</object>
<packing>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
<signal name="toggled" handler="hbfd_feature_changed_cb"/>
</object>
<packing>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
</object>
</dict>
<key>Preferences</key>
<dict>
+ <key>EncodeLogLocation</key>
+ <false />
<key>allow_tweaks</key>
<false />
<key>chapters_in_destination</key>
}
// 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);
}
gchar*
-ghb_get_user_config_dir()
+ghb_get_user_config_dir(gchar *subdir)
{
const gchar *dir;
gchar *config;
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;
}
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);
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))
{
{
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))
{
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,
" </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"
"="tweaks_changed_cb"/>\n"
" </object>\n"
" <packing>\n"
-" <property name="position">5"
+" <property name="position">6"
"</property>\n"
" </packing>\n"
" </child>\n"
"="hbfd_feature_changed_cb"/>\n"
" </object>\n"
" <packing>\n"
-" <property name="position">6"
+" <property name="position">7"
"</property>\n"
" </packing>\n"
" </child>\n"
" </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"
<property name="position">4</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>
<signal name="toggled" handler="tweaks_changed_cb"/>
</object>
<packing>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
<signal name="toggled" handler="hbfd_feature_changed_cb"/>
</object>
<packing>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
</object>
</dict>
<key>Preferences</key>
<dict>
+ <key>EncodeLogLocation</key>
+ <false />
<key>allow_tweaks</key>
<false />
<key>chapters_in_destination</key>
GValue *queue;
GValue *current_job;
GIOChannel *activity_log;
+ GIOChannel *job_activity_log;
} signal_user_data_t;
enum