From 20a822cb7a9f9a64a58f14c317db9339fec60eb2 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 7 Oct 2016 10:03:58 +0200 Subject: update verbose output --- mpd-notification.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mpd-notification.c b/mpd-notification.c index 194655b..abda00d 100644 --- a/mpd-notification.c +++ b/mpd-notification.c @@ -96,6 +96,9 @@ GdkPixbuf * retrieve_artwork(const char * music_dir, const char * uri) { goto image; } + if (verbose > 0) + printf("%s: MIME type for %s is: %s\n", program, uri_path, magic_mime); + if (strcmp(magic_mime, "audio/mpeg") != 0) goto image; @@ -114,7 +117,12 @@ GdkPixbuf * retrieve_artwork(const char * music_dir, const char * uri) { /* find the first attached picture, if available */ for (i = 0; i < pFormatCtx->nb_streams; i++) { if (pFormatCtx->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC) { - AVPacket pkt = pFormatCtx->streams[i]->attached_pic; + AVPacket pkt; + + if (verbose > 0) + printf("%s: Found artwork in media file.\n", program); + + pkt = pFormatCtx->streams[i]->attached_pic; loader = gdk_pixbuf_loader_new(); gdk_pixbuf_loader_write(loader, pkt.data, pkt.size, NULL); @@ -146,6 +154,9 @@ image: continue; if (regexec(®ex, entry->d_name, 0, NULL, 0) == 0) { + if (verbose > 0) + printf("%s: Found image file: %s\n", program, entry->d_name); + imagefile = malloc(strlen(uri_path) + strlen(entry->d_name) + 2); sprintf(imagefile, "%s/%s", uri_path, entry->d_name); pixbuf = gdk_pixbuf_new_from_file(imagefile, NULL); @@ -380,9 +391,6 @@ int main(int argc, char ** argv) { pixbuf = retrieve_artwork(music_dir, uri); - if (verbose > 0 && pixbuf != NULL) - printf("%s: found artwork in or near media file: %s/%s\n", program, music_dir, uri); - if (scale > 0) { int x, y; -- cgit v1.2.3-54-g00ecf