diff options
| author | Nicholas Piper <nicholas@users.sourceforge.net> | 2007-03-26 14:00:54 +0000 |
|---|---|---|
| committer | Nicholas Piper <nicholas@users.sourceforge.net> | 2007-03-26 14:00:54 +0000 |
| commit | 18dc3bfea7dbfea9cf07e12cdcf494d9e03b45dd (patch) | |
| tree | c4636cb882f9f090c5eb210d0dfd70be3f6b42de /bindings/python/examples | |
| parent | 8dc33f0a34224afc1c69797e2a09c39635ea357b (diff) | |
| download | libgpod-18dc3bfea7dbfea9cf07e12cdcf494d9e03b45dd.tar.gz libgpod-18dc3bfea7dbfea9cf07e12cdcf494d9e03b45dd.tar.xz libgpod-18dc3bfea7dbfea9cf07e12cdcf494d9e03b45dd.zip | |
Add some PhotoDB reading features, thanks to John Carr for prompting.
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1410 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'bindings/python/examples')
| -rwxr-xr-x | bindings/python/examples/save_photos.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/bindings/python/examples/save_photos.py b/bindings/python/examples/save_photos.py new file mode 100755 index 0000000..abf23ed --- /dev/null +++ b/bindings/python/examples/save_photos.py @@ -0,0 +1,39 @@ +#!/usr/bin/python + +## Copyright (C) 2007 Nick Piper <nick-gtkpod at nickpiper co uk> +## Part of the gtkpod project. + +## URL: http://www.gtkpod.org/ +## URL: http://gtkpod.sourceforge.net/ + +## The code contained in this file is free software; you can redistribute +## it and/or modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either version +## 2.1 of the License, or (at your option) any later version. + +## This file is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. + +## You should have received a copy of the GNU Lesser General Public +## License along with this code; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# this file is just a little example to see how you could read photos + +import gpod + +photodb = gpod.PhotoDatabase("/mnt/ipod") + +print photodb +for album in photodb.PhotoAlbums: + print " ", album + for photo in album: + print " ", photo + for thumbnail, n in zip(photo.thumbnails, + range(0,len(photo.thumbnails))): + print " ", thumbnail + thumbnail.save_image("/tmp/%d-%d.png" % (photo['id'],n)) + +photodb.close() |
