FlickrTouchr.py – keep your flickr album and favourites on an iPod Touch or iPhone
Posted on January 21, 2008, under general, photography.
One of the great things I really like about the iPod touch is that it makes an excellent portable viewer for photos. In return for sacrificing 1GB of potential music storage, I get about 2,000 browseable, zoomable photos onto something that’s always in my pocket. Cool!
![]() |
![]() |
To make the process easier, here’s a python script to synchronise the photos on an ipod from a flickr account. It’s at http://www.stdlib.net/~colmmacc/flickrtouchr.py.txt. It should run on any *nix platform (personally I’m running it on a Mac) and there’s some kind of a chance it might even work on Windows (but who knows).
The whole thing is a single python file, as implementing the flickr API calls myself rather than use any of various python flickr libraries (as they each seem poorly maintained) seemed easier. One of the reasons I’m even putting it online is that beyond anything else, it may be useful as an example of a truly minimal python implementation with the flickr API.
You run the script like so;
flickrtouchr directory-name
and after it asks you to authenticate against your flickr account, it will progress through syncing your entire flickr account into a directory hierarchy. It keeps a small cache of authentication data in the directory too. It will be organised like;
directory-name/set-name/[photos]
directory-name/other-set-name/[photos]
directory-name/No Set/[photos]
directory-name/Favourites/[photos]
If you have the same photo in multiple sets it will use hard-links to preserve local disk-space. It also only downloads the most optimal version of the photograph available for the iPod touch/iPhone screen. Everytime you run it, it downloads the missing photos and new sets. Once you configure iTunes to synchronise photos from a folder, rather than iPhoto, it works great.

Of course it will work with any other device or software that takes photo from a hierarchy of folders. Happy flickring.
8 Replies to "FlickrTouchr.py – keep your flickr album and favourites on an iPod Touch or iPhone"
colmmacc on January 29, 2008
Thanks for the bug report Paul, the fix is;
--- flickrtouchr.py.txt 2008-01-28 23:51:13.000000000 +0000
+++ flickrtouchr.py.txt 2008-01-28 23:49:52.000000000 +0000
@@ -285,7 +285,7 @@
# Grab the photos
for photo in dom.getElementsByTagName("photo"):
# Tell the user we're grabbing the file
- print photo.getAttribute("title") + " ... in set ... " + dir
+ print photo.getAttribute("title").encode("utf8") + " ... in set ... " + dir
# Grab the id
photoid = photo.getAttribute("id")
And I’ve updated the version online :-)
Dennis Bonilla on May 6, 2008
Is this resource still being maintained?
I ran into the following issue when trying to run it.
Traceback (most recent call last):
File “/Users/dbonilla/Desktop/pics/flickrtouchr.py”, line 222, in ?
url = flickrsign(url, config["token"])
File “/Users/dbonilla/Desktop/pics/flickrtouchr.py”, line 131, in flickrsign
query = urlparse.urlparse(url).query
AttributeError: ‘tuple’ object has no attribute ‘query’
Dennis Bonilla on May 8, 2008
I appear to only receive that error on a 10.4 machine. The script ran flawlessly on OS X 10.5.2. Thank you!
Larry Rosenstein on June 6, 2009
That error appears if you run the script on a Python older than 2.5. (OS X 10.4 ships with 2.3.x.) I got it to run on 2.3 by changing:
query = urlparse.urlparse(url).query
to:
query = urlparse.urlparse(url)[4]
fozbaca on June 6, 2009
All my photos are downloading corrupted. I’m using Python 2.6.2 on Windows7RC. Any suggestions?
tozé on June 10, 2009
my favorites downloaded without problems, but when it got to my own photos it would spit back this
Failed to get original for photo id xxxxxxxxxx
Failed to retrieve photo id xxxxxxxxxx
I’m running the script on 10.5.6
Thank you


Paul Mison on January 28, 2008
Nice script. I was planning to do this by having a Flickr set inside iPhoto, but this also lets you do things with other people’s photos (namely, your favourites), and it also saves me getting everything up and running, so I thought I’d give it a go.
However, it’s breaking on a photo of mine with a non-ASCII (UTF8) title, giving the error
Traceback (most recent call last):
File “/Users/blech/Desktop/touchr.py”, line 288, in
print photo.getAttribute(”title”) + ” … in set … ” + dir
UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xed’ in position 3: ordinal not in range(128)
I’ve got a vague idea of how to fix it, and I may come back with a patch, but for now I thought I’d at least make you aware of the issue. Thanks for the script anyway (and you’re right about unmaintained libraries- well, Ruby’s Flickr libs are in disrepair too, so I’m not entirely surprised Python’s the same way).