diff options
| author | Nicholas Piper <nicholas@users.sourceforge.net> | 2006-04-09 16:38:12 +0000 |
|---|---|---|
| committer | Nicholas Piper <nicholas@users.sourceforge.net> | 2006-04-09 16:38:12 +0000 |
| commit | 08de30de7733b07a17eed911ca1d4f02b030ad42 (patch) | |
| tree | bf60b90d0264d105ca06038d2da0137e58c926f3 /bindings/python/gpod.i | |
| parent | de94dbec8470b576f057a0862f7316b93559e6a5 (diff) | |
| download | libgpod-08de30de7733b07a17eed911ca1d4f02b030ad42.tar.gz libgpod-08de30de7733b07a17eed911ca1d4f02b030ad42.tar.xz libgpod-08de30de7733b07a17eed911ca1d4f02b030ad42.zip | |
Very start of a much nicer API from Python
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1242 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'bindings/python/gpod.i')
| -rw-r--r-- | bindings/python/gpod.i | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/bindings/python/gpod.i b/bindings/python/gpod.i index 1c0edc7..7103ecf 100644 --- a/bindings/python/gpod.i +++ b/bindings/python/gpod.i @@ -49,6 +49,20 @@ PyObject* sw_get_tracks(Itdb_iTunesDB *itdb) { return list; } +PyObject* sw_get_track(GList *list, gint index) { + GList *position; + if ( (index >= g_list_length(list)) || index < 0 ) { + PyErr_SetString(PyExc_IndexError, "Value out of range"); + return NULL; + } + position = g_list_nth(list, index); + return SWIG_NewPointerObj((void*)(position->data), SWIGTYPE_p__Itdb_Track, 0); + } + +PyObject* sw_get_list_len(GList *list) { + return PyInt_FromLong(g_list_length(list)); + } + PyObject* sw_get_playlist_tracks(Itdb_Playlist *pl) { PyObject *list; gint i; @@ -88,12 +102,28 @@ typedef char gchar; } } +%typemap(out) guint64 { + $result = PyLong_FromLong($1); +} + +%typemap(out) guint32 { + $result = PyInt_FromLong($1); +} + +%typemap(out) guint16 { + $result = PyInt_FromLong($1); +} + + %typemap(out) guint8 { $result = PyInt_FromLong($1); } typedef int gboolean; +typedef long gint64; typedef int gint32; +typedef int gint16; +typedef int gint; typedef unsigned int guint32; @@ -101,6 +131,8 @@ typedef unsigned int guint32; #define G_END_DECLS PyObject* sw_get_tracks(Itdb_iTunesDB *itdb); +PyObject* sw_get_track(GList *list, gint index); +PyObject* sw_get_list_len(GList *list); PyObject* sw_get_playlists(Itdb_iTunesDB *itdb); PyObject* sw_get_playlist_tracks(Itdb_Playlist *pl); %include "../../src/itdb.h" |
