[tracker-miners/wip/carlosg/extraction-fixes: 4/8] tracker-extract: Demote g_message to g_debug in extractor modules




commit e0e1b9d87f7375643fcf8b7df89cda6af285b4a5
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Sep 30 14:02:52 2020 +0200

    tracker-extract: Demote g_message to g_debug in extractor modules
    
    We now don't have a log handler that redirects g_message()s anywhere,
    so they get to stdout/journal. This spew is most times unnecessary to
    look, so make it g_debug() so it requires G_MESSAGES_DEBUG=Tracker in
    place.

 src/libtracker-extract/tracker-exif.c              | 20 ++++++------
 src/tracker-extract/tracker-extract-bmp.c          | 10 +++---
 src/tracker-extract/tracker-extract-dvi.c          |  2 +-
 src/tracker-extract/tracker-extract-gif.c          |  8 ++---
 src/tracker-extract/tracker-extract-gstreamer.c    |  4 +--
 src/tracker-extract/tracker-extract-icon.c         | 16 ++++-----
 src/tracker-extract/tracker-extract-iso.c          |  4 +--
 src/tracker-extract/tracker-extract-mp3.c          | 38 +++++++++++-----------
 src/tracker-extract/tracker-extract-msoffice-xml.c | 14 ++++----
 src/tracker-extract/tracker-extract-msoffice.c     |  2 +-
 src/tracker-extract/tracker-extract-oasis.c        |  4 +--
 src/tracker-extract/tracker-extract-playlist.c     |  6 ++--
 src/tracker-extract/tracker-extract-text.c         |  2 +-
 13 files changed, 65 insertions(+), 65 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-exif.c b/src/libtracker-extract/tracker-exif.c
index df4ef6362..86c1aa0c4 100644
--- a/src/libtracker-extract/tracker-exif.c
+++ b/src/libtracker-extract/tracker-exif.c
@@ -351,19 +351,19 @@ get_gps_coordinate (ExifData *exif,
                        exif_entry_get_value (entry, buf, sizeof (buf) - 1);
 
                        if (buf[0] == '\0') {
-                               g_message ("EXIF GPS coordinate information is non-existent but EXIF tag '%s' 
was found, "
-                                          "possible broken EXIF data?",
-                                          exif_tag_get_name (tag));
+                               g_debug ("EXIF GPS coordinate information is non-existent but EXIF tag '%s' 
was found, "
+                                        "possible broken EXIF data?",
+                                        exif_tag_get_name (tag));
                        } else {
-                               g_message ("EXIF GPS coordinate information is partial, "
-                                          "got EXIF tag '%s' with value '%s', "
-                                          "expected with degrees, minutes and seconds",
-                                          exif_tag_get_name (tag),
-                                          buf);
+                               g_debug ("EXIF GPS coordinate information is partial, "
+                                        "got EXIF tag '%s' with value '%s', "
+                                        "expected with degrees, minutes and seconds",
+                                        exif_tag_get_name (tag),
+                                        buf);
                        }
 
-                       g_message ("EXIF GPS coordinate information could not be extracted with tag '%s'",
-                                  exif_tag_get_name (tag));
+                       g_debug ("EXIF GPS coordinate information could not be extracted with tag '%s'",
+                                exif_tag_get_name (tag));
                }
        }
 
diff --git a/src/tracker-extract/tracker-extract-bmp.c b/src/tracker-extract/tracker-extract-bmp.c
index a57bb9aa8..3d924c943 100644
--- a/src/tracker-extract/tracker-extract-bmp.c
+++ b/src/tracker-extract/tracker-extract-bmp.c
@@ -47,7 +47,7 @@ get_img_resolution (const GFile *file,
 
        stream = g_file_read ((GFile *)file, NULL, &error);
        if (error) {
-               g_message ("Could not read BMP file, %s", error->message);
+               g_debug ("Could not read BMP file, %s", error->message);
                g_clear_error (&error);
                return FALSE;
        }
@@ -55,27 +55,27 @@ get_img_resolution (const GFile *file,
        inputstream = G_INPUT_STREAM (stream);
 
        if (!g_input_stream_read (inputstream, bfType, 2, NULL, &error)) {
-               g_message ("Could not read BMP header from stream, %s", error ? error->message : "No error 
given");
+               g_debug ("Could not read BMP header from stream, %s", error ? error->message : "No error 
given");
                g_clear_error (&error);
                g_object_unref (stream);
                return FALSE;
        }
 
        if (bfType[0] != 'B' || bfType[1] != 'M') {
-               g_message ("Expected BMP header to read 'B' or 'M', can not continue");
+               g_debug ("Expected BMP header to read 'B' or 'M', can not continue");
                g_object_unref (stream);
                return FALSE;
        }
 
        if (!g_input_stream_skip (inputstream, 16, NULL, &error)) {
-               g_message ("Could not read 16 bytes from BMP header, %s", error ? error->message : "No error 
given");
+               g_debug ("Could not read 16 bytes from BMP header, %s", error ? error->message : "No error 
given");
                g_clear_error (&error);
                g_object_unref (stream);
                return FALSE;
        }
 
        if (!g_input_stream_read (inputstream, &w, sizeof (uint), NULL, &error)) {
-               g_message ("Could not read width from BMP header, %s", error ? error->message : "No error 
given");
+               g_debug ("Could not read width from BMP header, %s", error ? error->message : "No error 
given");
                g_clear_error (&error);
                g_object_unref (stream);
                return FALSE;
diff --git a/src/tracker-extract/tracker-extract-dvi.c b/src/tracker-extract/tracker-extract-dvi.c
index 48c6aef37..8e32021ef 100644
--- a/src/tracker-extract/tracker-extract-dvi.c
+++ b/src/tracker-extract/tracker-extract-dvi.c
@@ -140,7 +140,7 @@ mdvi_init_context (const char *file)
        }
 
        if ((arg = fuget1 (p)) != DVI_ID) {
-               g_message ("Unsupported DVI format (version %u)", arg);
+               g_debug ("Unsupported DVI format (version %u)", arg);
                goto error;
        }
 
diff --git a/src/tracker-extract/tracker-extract-gif.c b/src/tracker-extract/tracker-extract-gif.c
index f30069797..6b0d2897f 100644
--- a/src/tracker-extract/tracker-extract-gif.c
+++ b/src/tracker-extract/tracker-extract-gif.c
@@ -75,9 +75,9 @@ gif_error (const gchar *action, int err)
 {
        const char *str = GifErrorString (err);
        if (str != NULL) {
-               g_message ("%s, error: '%s'", action, str);
+               g_debug ("%s, error: '%s'", action, str);
        } else {
-               g_message ("%s, undefined error %d", action, err);
+               g_debug ("%s, undefined error %d", action, err);
        }
 }
 #else /* GIFLIB_MAJOR >= 5 */
@@ -86,9 +86,9 @@ static inline void print_gif_error()
 #if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || 
GIFLIB_MAJOR > 4)
        const char *str = GifErrorString ();
        if (str != NULL) {
-               g_message ("GIF, error: '%s'", str);
+               g_debug ("GIF, error: '%s'", str);
        } else {
-               g_message ("GIF, undefined error");
+               g_debug ("GIF, undefined error");
        }
 #else
        PrintGifError();
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 27b18bbca..6db34f71c 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -1171,8 +1171,8 @@ discoverer_init_and_run (MetadataExtractor *extractor,
        if (error) {
                if (gst_discoverer_info_get_result(info) == GST_DISCOVERER_MISSING_PLUGINS) {
                        required_plugins_message = get_discoverer_required_plugins_message (info);
-                       g_message ("Missing a GStreamer plugin for %s. %s", uri,
-                                  required_plugins_message);
+                       g_debug ("Missing a GStreamer plugin for %s. %s", uri,
+                                required_plugins_message);
                        g_free (required_plugins_message);
                } else if (error->domain != GST_STREAM_ERROR ||
                           (error->code != GST_STREAM_ERROR_TYPE_NOT_FOUND &&
diff --git a/src/tracker-extract/tracker-extract-icon.c b/src/tracker-extract/tracker-extract-icon.c
index a7bf2a87f..05f482b36 100644
--- a/src/tracker-extract/tracker-extract-icon.c
+++ b/src/tracker-extract/tracker-extract-icon.c
@@ -43,9 +43,9 @@ find_max_width_and_height (const gchar *uri,
        file = g_file_new_for_uri (uri);
        stream = g_file_read (file, NULL, &error);
        if (error) {
-               g_message ("Could not read file '%s': %s",
-                          uri,
-                          error->message);
+               g_debug ("Could not read file '%s': %s",
+                        uri,
+                        error->message);
                g_error_free (error);
                g_object_unref (file);
 
@@ -65,8 +65,8 @@ find_max_width_and_height (const gchar *uri,
                                      NULL,
                                      NULL,
                                      &error)) {
-               g_message ("Error reading icon header from stream: '%s'",
-                          error->message);
+               g_debug ("Error reading icon header from stream: '%s'",
+                        error->message);
                g_error_free (error);
                g_object_unref (stream);
                g_object_unref (file);
@@ -91,9 +91,9 @@ find_max_width_and_height (const gchar *uri,
                                              NULL,
                                              NULL,
                                              &error)) {
-                       g_message ("Error reading icon image metadata '%u' from stream: '%s'",
-                                  i,
-                                  error->message);
+                       g_debug ("Error reading icon image metadata '%u' from stream: '%s'",
+                                i,
+                                error->message);
                        g_error_free (error);
                        break;
                }
diff --git a/src/tracker-extract/tracker-extract-iso.c b/src/tracker-extract/tracker-extract-iso.c
index 2614e5915..9dc77e18a 100644
--- a/src/tracker-extract/tracker-extract-iso.c
+++ b/src/tracker-extract/tracker-extract-iso.c
@@ -65,8 +65,8 @@ tracker_extract_get_metadata (TrackerExtractInfo *info_)
        if (error != NULL) {
                if (error->code != OSINFO_MEDIA_ERROR_NOT_BOOTABLE) {
                        g_object_unref (metadata);
-                       g_message ("Could not extract iso info from '%s': %s",
-                                  filename, error->message);
+                       g_debug ("Could not extract iso info from '%s': %s",
+                                filename, error->message);
                        g_free (filename);
                        g_error_free (error);
                        return FALSE;
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index aed6350ff..c33f82a97 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -2145,7 +2145,7 @@ parse_id3v24 (const gchar           *data,
 
        /* We don't handle experimental cases */
        if (experimental) {
-               g_message ("[v24] Experimental MP3s are not extracted, doing nothing");
+               g_debug ("[v24] Experimental MP3s are not extracted, doing nothing");
                return;
        }
 
@@ -2161,7 +2161,7 @@ parse_id3v24 (const gchar           *data,
         * bytes, so we check that there is some content AFTER the
         * headers. */
        if (tsize > size - header_size) {
-               g_message ("[v24] Expected MP3 tag size and header size to be within file size boundaries");
+               g_debug ("[v24] Expected MP3 tag size and header size to be within file size boundaries");
                return;
        }
 
@@ -2183,7 +2183,7 @@ parse_id3v24 (const gchar           *data,
                 * the headers, in other words the padding.
                 */
                if (ext_header_size > size - header_size - tsize) {
-                       g_message ("[v24] Expected MP3 tag size and extended header size to be within file 
size boundaries");
+                       g_debug ("[v24] Expected MP3 tag size and extended header size to be within file size 
boundaries");
                        return;
                }
 
@@ -2204,10 +2204,10 @@ parse_id3v24 (const gchar           *data,
                 *   Flags          $xx xx
                 */
                if (pos + frame_size > tsize + header_size) {
-                       g_message ("[v24] Expected MP3 frame size (%d) to be within tag size (%d) boundaries, 
position = %d",
-                                  frame_size,
-                                  tsize + header_size,
-                                  pos);
+                       g_debug ("[v24] Expected MP3 frame size (%d) to be within tag size (%d) boundaries, 
position = %d",
+                                frame_size,
+                                tsize + header_size,
+                                pos);
                        break;
                }
 
@@ -2349,7 +2349,7 @@ parse_id3v23 (const gchar          *data,
 
        /* We don't handle experimental cases */
        if (experimental) {
-               g_message ("[v23] Experimental MP3s are not extracted, doing nothing");
+               g_debug ("[v23] Experimental MP3s are not extracted, doing nothing");
                return;
        }
 
@@ -2365,7 +2365,7 @@ parse_id3v23 (const gchar          *data,
         * bytes, so we check that there is some content AFTER the
         * headers. */
        if (tsize > size - header_size) {
-               g_message ("[v23] Expected MP3 tag size and header size to be within file size boundaries");
+               g_debug ("[v23] Expected MP3 tag size and header size to be within file size boundaries");
                return;
        }
 
@@ -2387,7 +2387,7 @@ parse_id3v23 (const gchar          *data,
                 * the headers, in other words the padding.
                 */
                if (ext_header_size > size - header_size - tsize) {
-                       g_message ("[v23] Expected MP3 tag size and extended header size to be within file 
size boundaries");
+                       g_debug ("[v23] Expected MP3 tag size and extended header size to be within file size 
boundaries");
                        return;
                }
 
@@ -2408,10 +2408,10 @@ parse_id3v23 (const gchar          *data,
                 *   Flags          $xx xx
                 */
                if (pos + frame_size > tsize + header_size) {
-                       g_message ("[v23] Expected MP3 frame size (%d) to be within tag size (%d) boundaries, 
position = %d",
-                                  frame_size,
-                                  tsize + header_size,
-                                  pos);
+                       g_debug ("[v23] Expected MP3 frame size (%d) to be within tag size (%d) boundaries, 
position = %d",
+                                frame_size,
+                                tsize + header_size,
+                                pos);
                        break;
                }
 
@@ -2528,7 +2528,7 @@ parse_id3v20 (const gchar          *data,
        tsize = extract_uint32_7bit (&data[6]);
 
        if (tsize > size - header_size)  {
-               g_message ("[v20] Expected MP3 tag size and header size to be within file size boundaries");
+               g_debug ("[v20] Expected MP3 tag size and header size to be within file size boundaries");
                return;
        }
 
@@ -2542,10 +2542,10 @@ parse_id3v20 (const gchar          *data,
                g_assert (pos <= size - frame_size);
 
                if (pos + frame_size > tsize + header_size)  {
-                       g_message ("[v20] Expected MP3 frame size (%d) to be within tag size (%d) boundaries, 
position = %d",
-                                  frame_size,
-                                  tsize + header_size,
-                                  pos);
+                       g_debug ("[v20] Expected MP3 frame size (%d) to be within tag size (%d) boundaries, 
position = %d",
+                                frame_size,
+                                tsize + header_size,
+                                pos);
                        break;
                }
 
diff --git a/src/tracker-extract/tracker-extract-msoffice-xml.c 
b/src/tracker-extract/tracker-extract-msoffice-xml.c
index c6d67d400..ddf85c4a0 100644
--- a/src/tracker-extract/tracker-extract-msoffice-xml.c
+++ b/src/tracker-extract/tracker-extract-msoffice-xml.c
@@ -252,7 +252,7 @@ msoffice_xml_content_parse_start (GMarkupParseContext  *context,
                break;
 
        case FILE_TYPE_INVALID:
-               g_message ("Microsoft document type:%d invalid", info->file_type);
+               g_debug ("Microsoft document type:%d invalid", info->file_type);
                break;
        }
 }
@@ -679,9 +679,9 @@ msoffice_xml_content_types_parse_start (GMarkupParseContext  *context,
 
        /* Both part_name and content_type MUST be NON-NULL */
        if (!part_name || !content_type) {
-               g_message ("Invalid file (part_name:%s, content_type:%s)",
-                          part_name ? part_name : "none",
-                          content_type ? content_type : "none");
+               g_debug ("Invalid file (part_name:%s, content_type:%s)",
+                        part_name ? part_name : "none",
+                        content_type ? content_type : "none");
                return;
        }
 
@@ -694,8 +694,8 @@ msoffice_xml_content_types_parse_start (GMarkupParseContext  *context,
 
        /* If the file type is unknown, skip trying to extract content */
        if (info->file_type == FILE_TYPE_INVALID) {
-               g_message ("Invalid file type, not extracting content from '%s'",
-                          part_name + 1);
+               g_debug ("Invalid file type, not extracting content from '%s'",
+                        part_name + 1);
                return;
        }
 
@@ -762,7 +762,7 @@ msoffice_xml_get_file_type (const gchar *uri)
                /* MsOffice Excel document */
                file_type = FILE_TYPE_XLSX;
        } else {
-               g_message ("Mime type was not recognised:'%s'", mime_used);
+               g_debug ("Mime type was not recognised:'%s'", mime_used);
                file_type = FILE_TYPE_INVALID;
        }
 
diff --git a/src/tracker-extract/tracker-extract-msoffice.c b/src/tracker-extract/tracker-extract-msoffice.c
index d62a404b3..f91481cd5 100644
--- a/src/tracker-extract/tracker-extract-msoffice.c
+++ b/src/tracker-extract/tracker-extract-msoffice.c
@@ -1682,7 +1682,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 
                content = extract_excel_content (infile, max_bytes, &is_encrypted);
        } else {
-               g_message ("Mime type was not recognised:'%s'", mime_used);
+               g_debug ("Mime type was not recognised:'%s'", mime_used);
        }
 
        if (content) {
diff --git a/src/tracker-extract/tracker-extract-oasis.c b/src/tracker-extract/tracker-extract-oasis.c
index 7dfcfc020..6f104290f 100644
--- a/src/tracker-extract/tracker-extract-oasis.c
+++ b/src/tracker-extract/tracker-extract-oasis.c
@@ -226,7 +226,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *extract_info)
        } else if (g_ascii_strcasecmp (mime_used, "application/vnd.oasis.opendocument.graphics") == 0) {
                file_type = FILE_TYPE_ODG;
        } else {
-               g_message ("Mime type was not recognised:'%s'", mime_used);
+               g_debug ("Mime type was not recognised:'%s'", mime_used);
                file_type = FILE_TYPE_INVALID;
        }
 
@@ -485,7 +485,7 @@ xml_start_element_handler_content (GMarkupParseContext  *context,
                return;
 
        case FILE_TYPE_INVALID:
-               g_message ("Open Office Document type: %d invalid", data->file_type);
+               g_debug ("Open Office Document type: %d invalid", data->file_type);
                push_tag (ODT_TAG_TYPE_UNKNOWN);
                return;
        }
diff --git a/src/tracker-extract/tracker-extract-playlist.c b/src/tracker-extract/tracker-extract-playlist.c
index 957ab4ce9..8c354bab0 100644
--- a/src/tracker-extract/tracker-extract-playlist.c
+++ b/src/tracker-extract/tracker-extract-playlist.c
@@ -77,7 +77,7 @@ entry_parsed (TotemPlParser *parser,
 
        if (data->track_counter > 1000) {
                /* limit playlists to 1000 entries for query performance reasons */
-               g_message ("Playlist has > 1000 entries. Ignoring for performance reasons.");
+               g_debug ("Playlist has > 1000 entries. Ignoring for performance reasons.");
                return;
        }
 
@@ -143,11 +143,11 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 
        if (totem_pl_parser_parse (pl, uri, FALSE) == TOTEM_PL_PARSER_RESULT_SUCCESS) {
                if (data.title != NULL) {
-                       g_message ("Playlist title:'%s'", data.title);
+                       g_debug ("Playlist title:'%s'", data.title);
                        tracker_resource_set_string (metadata, "nie:title", data.title);
                        g_free (data.title);
                } else {
-                       g_message ("Playlist has no title, attempting to get one from filename");
+                       g_debug ("Playlist has no title, attempting to get one from filename");
                        tracker_guarantee_resource_title_from_file (metadata, "nie:title", NULL, uri, NULL);
                }
 
diff --git a/src/tracker-extract/tracker-extract-text.c b/src/tracker-extract/tracker-extract-text.c
index 9d3a693f1..3ac111b05 100644
--- a/src/tracker-extract/tracker-extract-text.c
+++ b/src/tracker-extract/tracker-extract-text.c
@@ -118,7 +118,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 
                if (error != NULL) {
                        /* An error occurred, perhaps the file was deleted. */
-                       g_message ("Error extracting content: %s", error->message);
+                       g_debug ("Error extracting content: %s", error->message);
                        g_error_free (error);
                        return FALSE;
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]