From 8697e6e2b75c521980fc760ca6852de324c45c72 Mon Sep 17 00:00:00 2001 From: Nicholas Piper Date: Sat, 8 Apr 2006 18:10:15 +0000 Subject: 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 --- bindings/python/gpod.i | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bindings/python/gpod.i') 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 -- cgit