diff options
| author | Nicholas Piper <nicholas@users.sourceforge.net> | 2006-04-08 18:10:15 +0000 |
|---|---|---|
| committer | Nicholas Piper <nicholas@users.sourceforge.net> | 2006-04-08 18:10:15 +0000 |
| commit | 32ccf6d5a876f209fe88efb22741e565b13e69b4 (patch) | |
| tree | b2a3c5e713ef580cbb8f55a175dfc8236cd6d1ea /bindings/python/gpod.i | |
| parent | d90ebaed107ef6a880f6744919ec9e629b374408 (diff) | |
| download | libgpod-32ccf6d5a876f209fe88efb22741e565b13e69b4.tar.gz libgpod-32ccf6d5a876f209fe88efb22741e565b13e69b4.tar.xz libgpod-32ccf6d5a876f209fe88efb22741e565b13e69b4.zip | |
Provide typemap for guint8, and use to provide podcast support in add_songs.py example.
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1234 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'bindings/python/gpod.i')
| -rw-r--r-- | bindings/python/gpod.i | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bindings/python/gpod.i b/bindings/python/gpod.i index 11670b8..482e5eb 100644 --- a/bindings/python/gpod.i +++ b/bindings/python/gpod.i @@ -77,8 +77,20 @@ PyObject* sw_get_playlists(Itdb_iTunesDB *itdb) { # them utf8 encoded Strings. typedef char gchar; +%typemap(in) guint8 { + long ival; + ival = PyInt_AsLong($input); + if (( ival > 255 ) || ( ival < 0 )) { + PyErr_SetString(PyExc_ValueError, "Value must be between 0 and 255"); + SWIG_fail; + } else { + $1 = (guint8) ival; + } +} + typedef int gboolean; typedef int gint32; + typedef unsigned int guint32; #define G_BEGIN_DECLS |
