for (it = m_itdb->tracks; it != NULL; it = it->next) {
Itdb_Track *song = (Itdb_Track *)it->data;
if (song->has_artwork == 0x02) {
continue;
}
GdkPixbuf *pixbuf = (GdkPixbuf*) itdb_artwork_get_pixbuf( song->itdb->device,
song->artwork, -1, -1);
if(pixbuf == NULL ) {
debug() << "unexpected null pixbuf";
continue;
}
g_print ("Track %d (%016"G_GINT64_MODIFIER"x) %s-%s-%s (%08x)\n",
count, song->dbid,
song->artist, song->album,
song->title, song->mhii_link);
gint width;
gint height;
gchar* filename;
g_object_get (G_OBJECT (pixbuf),
"width", &width,
"height", &height,
NULL);
filename = g_strdup_printf ("/home/seb/%d-%s-%s-%s-%dx%d.png", count, song->artist, song->album, song->title, width, height);
g_print (" --> %s\n", filename );
gdk_pixbuf_save (pixbuf, filename, "png", NULL, NULL);
gdk_pixbuf_unref (pixbuf);
g_free (filename);
count++;
}