Tool to get album art and paths from hildon-thumbnailer
authorIvan Frade <ivan.frade@gmail.com>
Wed, 9 Sep 2009 07:52:00 +0000 (10:52 +0300)
committerIvan Frade <ivan.frade@gmail.com>
Wed, 9 Sep 2009 07:52:00 +0000 (10:52 +0300)
MAFW uses hildon-thumbnailer, so these paths are the expected location
of the album art

tools/Makefile [new file with mode: 0644]
tools/ht-album-art.c [new file with mode: 0644]

diff --git a/tools/Makefile b/tools/Makefile
new file mode 100644 (file)
index 0000000..804003e
--- /dev/null
@@ -0,0 +1,2 @@
+all: 
+       gcc -o ht-album-art ht-album-art.c `pkg-config --cflags --libs glib-2.0 hildon-thumbnail`
\ No newline at end of file
diff --git a/tools/ht-album-art.c b/tools/ht-album-art.c
new file mode 100644 (file)
index 0000000..576b662
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * gcc -o ht-albumart ht-album-art.c `pkg-config --cflags --libs hildon-thumbnail`
+ */ 
+#include <hildon-albumart-factory.h>
+#include <hildon-thumbnail-factory.h>
+#include <glib.h>
+
+static gchar *artist = NULL;
+static gchar *album = NULL;
+
+static GOptionEntry   entries[] = {
+       { "artist", 'a', 0, G_OPTION_ARG_STRING, &artist,
+          "Artist",
+         NULL,
+       },
+       { "album", 'b', 0, G_OPTION_ARG_STRING, &album,
+          "Album",
+         NULL,
+       }
+};
+
+gint 
+main (gint argc, gchar **argv)
+{
+        gchar          *album_art, *thumbnail;
+        GOptionContext *context;
+
+        g_type_init ();
+
+       context = g_option_context_new ("- Ask image/thum path for album art");
+
+       g_option_context_add_main_entries (context, entries, NULL);
+       g_option_context_parse (context, &argc, &argv, NULL);
+
+
+        if (!album) {
+               gchar *help;
+
+               g_printerr ("%s\n\n",
+                           "Album is a mandatory field");
+
+               help = g_option_context_get_help (context, TRUE, NULL);
+               g_option_context_free (context);
+               g_printerr ("%s", help);
+               g_free (help);
+
+               return -1;
+        }
+
+        /*
+         * USE NULL for artist!!! (It is what UKMP and media player use!)
+         */
+        album_art = hildon_albumart_get_path (NULL, album, "album");
+        g_print ("album art: %s\n", album_art);
+
+        /*
+         * USE PATH!!! (not uri)
+         */
+        thumbnail = hildon_thumbnail_get_uri (album_art, 124, 124, FALSE);
+        g_print ("thumbnail (using image path): %s\n", thumbnail);
+
+        g_free (album_art);
+        g_free (thumbnail);
+
+        return 0;
+}