From 574c966ac9167665138c9c2881a3b8c54be4adc7 Mon Sep 17 00:00:00 2001 From: rod Date: Sun, 7 Jun 2009 19:33:57 -0700 Subject: [PATCH] Deal with unicode set names --- flickrtouchr.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flickrtouchr.py b/flickrtouchr.py index 3fcf4ce..78c1f41 100755 --- a/flickrtouchr.py +++ b/flickrtouchr.py @@ -20,6 +20,7 @@ import xml.dom.minidom import webbrowser import urlparse import urllib2 +import unicodedata import cPickle import md5 import sys @@ -238,6 +239,7 @@ if __name__ == '__main__': for set in sets: pid = set.getAttribute("id") dir = getText(set.getElementsByTagName("title")[0].childNodes) + dir = unicodedata.normalize('NFKD', dir.decode("utf-8", "ignore")).encode('ASCII', 'ignore') # Normalize to ASCII # Build the list of photos url = "http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos" @@ -294,7 +296,7 @@ if __name__ == '__main__': photoid = photo.getAttribute("id") # The target - target = dir.decode("utf8", "ignore") + "/" + photoid + ".jpg" + target = dir + "/" + photoid + ".jpg" # Skip files that exist if os.access(target, os.R_OK): -- 2.43.0