summaryrefslogtreecommitdiffstats
path: root/bindings/python
diff options
context:
space:
mode:
authorTodd Zullinger <tmz@pobox.com>2008-07-08 20:14:33 -0400
committerTodd Zullinger <tmz@pobox.com>2008-07-08 20:49:31 -0400
commit384fb5393b70d1ab3ed75bae1c4a91a5c7c2d998 (patch)
tree28c15927d7358618c9dd68aec89dac3e8e4c7345 /bindings/python
parentaaf9d48ca87f9149fca513f9ea4ae16a9dad2c68 (diff)
downloadlibgpod-384fb5393b70d1ab3ed75bae1c4a91a5c7c2d998.tar.gz
libgpod-384fb5393b70d1ab3ed75bae1c4a91a5c7c2d998.tar.xz
libgpod-384fb5393b70d1ab3ed75bae1c4a91a5c7c2d998.zip
Fix build of python bindings with new thumbnail API
This just fixes the build. More work needs to be done to properly adapt the bindings to the new API and make it usable from python.
Diffstat (limited to 'bindings/python')
-rw-r--r--bindings/python/gpod.i.in21
-rw-r--r--bindings/python/ipod.py17
2 files changed, 21 insertions, 17 deletions
diff --git a/bindings/python/gpod.i.in b/bindings/python/gpod.i.in
index e74d3d9..9960002 100644
--- a/bindings/python/gpod.i.in
+++ b/bindings/python/gpod.i.in
@@ -56,6 +56,7 @@ version = '.'.join(map(str, version_info))
#include "itdb.h"
#include "itdb_device.h"
#include "itdb_private.h"
+#include "itdb_thumb.h"
#include <time.h>
#include <datetime.h>
#ifdef HAVE_GDKPIXBUF
@@ -82,7 +83,7 @@ PyObject* sw_get_photoalbums(Itdb_PhotoDB *db);
PyObject* sw_get_photoalbum(GList *list, gint index);
PyObject* sw_get_photos(Itdb_PhotoDB *db);
PyObject* sw_get_photo(GList *list, gint index);
-PyObject* sw_get_artwork_thumbnails(Itdb_Artwork *artwork);
+PyObject* sw_get_artwork_thumbnails(Itdb_PhotoDB *db, Itdb_Artwork *artwork);
PyObject* sw_get_photoalbum_members(Itdb_PhotoAlbum *album);
PyObject* sw_ipod_device_to_dict(Itdb_Device *device);
void sw__track_extra_destroy (PyObject *data);
@@ -208,12 +209,15 @@ SWIGTYPE_p__Itdb_PhotoAlbum, 0));
return list;
}
- PyObject* sw_get_artwork_thumbnails(Itdb_Artwork *artwork) {
+ PyObject* sw_get_artwork_thumbnails(Itdb_PhotoDB *db, Itdb_Artwork *artwork) {
PyObject *list;
gint i;
- GList *l;
- list = PyList_New(g_list_length(artwork->thumbnails));
- for (l = artwork->thumbnails, i = 0; l; l = l->next, ++i) {
+ GList *l, *thumbnails;
+ Itdb_Thumb_Ipod *thumb;
+ thumb = (Itdb_Thumb_Ipod *)artwork->thumbnail;
+ thumbnails = itdb_thumb_ipod_to_pixbufs (db->device, thumb);
+ list = PyList_New(g_list_length(thumbnails));
+ for (l = thumbnails, i = 0; l; l = l->next, ++i) {
PyList_SET_ITEM(list, i, SWIG_NewPointerObj((void*)(l->data), SWIGTYPE_p__Itdb_Thumb, 0));
}
return list;
@@ -487,9 +491,10 @@ typedef int gint;
#ifdef HAVE_GDKPIXBUF
#ifdef HAVE_PYGOBJECT
-%typemap(out) gpointer itdb_thumb_get_gdk_pixbuf {
+%typemap(out) gpointer itdb_artwork_get_pixbuf {
$result = pygobject_new((GObject *)$1);
- g_object_unref($1);
+ if ($1)
+ g_object_unref($1);
}
%typemap(in) gpointer pixbuf {
@@ -515,7 +520,7 @@ PyObject* sw_get_photoalbum(GList *list, gint index);
PyObject* sw_get_photos(Itdb_PhotoDB *db);
PyObject* sw_get_photo(GList *list, gint index);
PyObject* sw_get_photoalbum_members(Itdb_PhotoAlbum *album);
-PyObject* sw_get_artwork_thumbnails(Itdb_Artwork *artwork);
+PyObject* sw_get_artwork_thumbnails(Itdb_PhotoDB *db, Itdb_Artwork *artwork);
PyObject* sw_ipod_device_to_dict(Itdb_Device *device);
%include "@top_srcdir@/src/itdb.h"
diff --git a/bindings/python/ipod.py b/bindings/python/ipod.py
index 053eda6..29a4a9a 100644
--- a/bindings/python/ipod.py
+++ b/bindings/python/ipod.py
@@ -965,16 +965,19 @@ class Photo:
raise KeyError('No such key: %s' % item)
def get_thumbnails(self):
+ db = self._database
+ if hasattr(self._database, '_itdb'):
+ db = self._database._itdb
return [Thumbnail(proxied_thumbnail=t,
ownerobject=self) for t in gpod.sw_get_artwork_thumbnails(
- self._photo)]
+ db, self._photo)]
thumbnails = property(get_thumbnails)
class Thumbnail:
"""A thumbnail in an Photo."""
- _proxied_attributes = [k for k in gpod._Itdb_Thumb.__dict__.keys()
+ _proxied_attributes = [k for k in gpod._Itdb_Artwork.__dict__.keys()
if not (k.startswith("_") or k.startswith("reserved"))]
def __init__(self, proxied_thumbnail=None, ownerobject=None):
@@ -1022,11 +1025,7 @@ class Thumbnail:
if pixbuf_support:
def get_pixbuf(self):
# this deals with coverart and photo albums
+ device = self.__ownerobject._database.device
if hasattr(self.__ownerobject._database,"_itdb"):
- return gpod.itdb_thumb_get_gdk_pixbuf(
- self.__ownerobject._database._itdb.device,
- self._thumbnail)
- else:
- return gpod.itdb_thumb_get_gdk_pixbuf(
- self.__ownerobject._database.device,
- self._thumbnail)
+ device = self.__ownerobject._database._itdb.device
+ return gpod.itdb_artwork_get_pixbuf(device, self._thumbnail)