From: Ivan Frade Date: Wed, 9 Sep 2009 07:52:00 +0000 (+0300) Subject: Tool to get album art and paths from hildon-thumbnailer X-Git-Tag: mussorgsky-0.3-1~3 X-Git-Url: https://vcs.maemo.org/git/?p=mussorgsky;a=commitdiff_plain;h=3e71b9dc27324e725d88d0b37e48ec244a083048 Tool to get album art and paths from hildon-thumbnailer MAFW uses hildon-thumbnailer, so these paths are the expected location of the album art --- diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 0000000..804003e --- /dev/null +++ b/tools/Makefile @@ -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 index 0000000..576b662 --- /dev/null +++ b/tools/ht-album-art.c @@ -0,0 +1,66 @@ +/* + * gcc -o ht-albumart ht-album-art.c `pkg-config --cflags --libs hildon-thumbnail` + */ +#include +#include +#include + +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; +}