summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGaël Bonithon <gael@xfce.org>2021-12-27 12:53:45 +0100
committerGaël Bonithon <gael@xfce.org>2021-12-27 13:11:20 +0100
commit3ea0a2d0f93f71e69c7b5db39e7c3a72dfea918a (patch)
tree0109a3ffaee681a20f9d2964a112a95508109714 /plugins
parent32fb595aff6fbc6e37656d510bbccb46e9c1af9e (diff)
downloadtumbler-3ea0a2d0f93f71e69c7b5db39e7c3a72dfea918a.tar.gz
Reserve some third-party API messages to debug logging
FFmpegthumbnailer is known to be really verbose, and we don't have a priori control on the messages that can be displayed by external thumbnailers (it can be in particular FFmpegthumbnailer). Fixes #10, related to #29.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/desktop-thumbnailer/desktop-thumbnailer.c14
-rw-r--r--plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c6
2 files changed, 16 insertions, 4 deletions
diff --git a/plugins/desktop-thumbnailer/desktop-thumbnailer.c b/plugins/desktop-thumbnailer/desktop-thumbnailer.c
index 96e357e..05c4433 100644
--- a/plugins/desktop-thumbnailer/desktop-thumbnailer.c
+++ b/plugins/desktop-thumbnailer/desktop-thumbnailer.c
@@ -263,7 +263,7 @@ desktop_thumbnailer_load_thumbnail (DesktopThumbnailer *thumbnailer,
{
GFileIOStream *stream;
GFile *tmpfile;
- gchar *exec;
+ gchar *exec, *std_err;
gchar **cmd_argv;
const gchar *tmpfilepath;
gboolean res;
@@ -271,6 +271,7 @@ desktop_thumbnailer_load_thumbnail (DesktopThumbnailer *thumbnailer,
gint size;
gchar *working_directory = NULL;
GdkPixbuf *source, *pixbuf = NULL;
+ gboolean verbose;
g_object_get (G_OBJECT (thumbnailer), "exec", &exec, NULL);
@@ -295,13 +296,20 @@ desktop_thumbnailer_load_thumbnail (DesktopThumbnailer *thumbnailer,
{
working_directory = g_path_get_dirname (path);
+ verbose = tumbler_util_is_debug_logging_enabled (G_LOG_DOMAIN);
res = g_spawn_sync (working_directory,
cmd_argv, NULL,
- G_SPAWN_SEARCH_PATH,
- NULL, NULL,
+ verbose ? G_SPAWN_SEARCH_PATH
+ : G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
NULL, NULL,
+ NULL, verbose ? &std_err : NULL,
NULL,
error);
+ if (verbose)
+ {
+ g_printerr ("%s", std_err);
+ g_free (std_err);
+ }
if (G_LIKELY (res))
{
diff --git a/plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c b/plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c
index 3b3494e..c6bf337 100644
--- a/plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c
+++ b/plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c
@@ -143,6 +143,7 @@ ffmpeg_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
gint dest_height;
gchar *path;
const gchar *uri;
+ gint res;
g_return_if_fail (IS_FFMPEG_THUMBNAILER (thumbnailer));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -206,7 +207,10 @@ ffmpeg_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
}
/* try to generate a thumbnail */
- if (video_thumbnailer_generate_thumbnail_to_buffer (ffmpeg_thumbnailer->video, path, v_data) != 0)
+ tumbler_util_toggle_stderr (G_LOG_DOMAIN);
+ res = video_thumbnailer_generate_thumbnail_to_buffer (ffmpeg_thumbnailer->video, path, v_data);
+ tumbler_util_toggle_stderr (G_LOG_DOMAIN);
+ if (res != 0)
{
/* there was an error, emit error signal */
g_set_error (&error, TUMBLER_ERROR, TUMBLER_ERROR_INVALID_FORMAT,