summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJorg Schuler <jcsjcs@users.sourceforge.net>2005-11-28 16:20:40 +0000
committerJorg Schuler <jcsjcs@users.sourceforge.net>2005-11-28 16:20:40 +0000
commitd1b17206d01ebd9c94aa20778cac4b0eed6bfa4a (patch)
tree1a6daa9453d7e9fe171fdf680c66d63a0eaabc27 /tests
parent93cfd1639a324a3a168b0438ad852b5d6c864e4d (diff)
downloadlibgpod-d1b17206d01ebd9c94aa20778cac4b0eed6bfa4a.tar.gz
libgpod-d1b17206d01ebd9c94aa20778cac4b0eed6bfa4a.tar.xz
libgpod-d1b17206d01ebd9c94aa20778cac4b0eed6bfa4a.zip
New API for thumbnail support: see src/itdb.h for details.
* src/itdb.h: Introduced Itdb_Artwork and ItdbThumbType and changed Itdb_Image to Itdb_Thumb throughout the source. * src/itdb_artwork.c: new file as backend for Itdb_Artwork support (new, free, duplicate, get_thumb_by_type, add_thumbnail, remove_thumbnail, remove_thumbnails), as well as for the Itdb_Thumb support (new, free, duplicate, get_gdk_pixbuf, get_filename) * src/itdb_track.c: new functions for artwork support (set_thumbnails, remove_thumbnails) * src/ithumb-writer.c: added support to write thumbnails in addition to existing thumbnails * src/db-artwork-parcer.c: (mhod3_get_ithmb_filename) * src/itdb_itunesdb.c: (update_artwork_info) * tests/test-covers.c: updated to new API. * tests/test-write-covers.c: updated to new API. Known issues: iTunes wipes off our thumbnails. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1180 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'tests')
-rw-r--r--tests/test-covers.c24
-rw-r--r--tests/test-write-covers.c4
2 files changed, 14 insertions, 14 deletions
diff --git a/tests/test-covers.c b/tests/test-covers.c
index 5816ce2..0a79cff 100644
--- a/tests/test-covers.c
+++ b/tests/test-covers.c
@@ -33,14 +33,14 @@
static void
-save_itdb_image (Itdb_iTunesDB *itdb, Itdb_Image *image, const char *filename)
+save_itdb_thumb (Itdb_iTunesDB *itdb, Itdb_Thumb *thumb, const char *filename)
{
- GdkPixbuf *thumb;
+ GdkPixbuf *pixbuf;
- thumb = itdb_image_get_gdk_pixbuf (itdb, image);
- if (thumb != NULL) {
- gdk_pixbuf_save (thumb, filename, "png", NULL, NULL);
- gdk_pixbuf_unref (thumb);
+ pixbuf = itdb_thumb_get_gdk_pixbuf (itdb->device, thumb);
+ if (pixbuf != NULL) {
+ gdk_pixbuf_save (pixbuf, filename, "png", NULL, NULL);
+ gdk_pixbuf_unref (pixbuf);
/* g_print ("Saved %s\n", filename); */
}
}
@@ -49,20 +49,20 @@ save_song_thumbnails (Itdb_Track *song)
{
GList *it;
- for (it = song->thumbnails; it != NULL; it = it->next) {
- Itdb_Image *image;
+ for (it = song->artwork->thumbnails; it != NULL; it = it->next) {
+ Itdb_Thumb *thumb;
gchar *filename;
- image = (Itdb_Image *)it->data;
- g_return_if_fail (image);
+ thumb = (Itdb_Thumb *)it->data;
+ g_return_if_fail (thumb);
filename = NULL;
filename = g_strdup_printf ("%s-%s-%s-%d-%016"G_GINT64_MODIFIER"x.png",
song->artist, song->album,
- song->title, image->type,
+ song->title, thumb->type,
song->dbid);
if (filename != NULL) {
- save_itdb_image (song->itdb, image, filename);
+ save_itdb_thumb (song->itdb, thumb, filename);
g_free (filename);
}
}
diff --git a/tests/test-write-covers.c b/tests/test-write-covers.c
index 88c0216..dab7fc0 100644
--- a/tests/test-write-covers.c
+++ b/tests/test-write-covers.c
@@ -97,11 +97,11 @@ main (int argc, char **argv)
const char *coverpath;
song = (Itdb_Track*)it->data;
- itdb_track_remove_thumbnail (song);
+ itdb_artwork_remove_thumbnails (song->artwork);
coverpath = g_list_nth_data (covers,
g_random_int_range (0, nb_covers));
- itdb_track_set_thumbnail (song, coverpath);
+ itdb_track_set_thumbnails (song, coverpath);
/* g_print ("%s - %s - %s gets %s\n",
song->artist, song->album, song->title, coverpath);*/