Skip to content

Commit

Permalink
Allow events with names having Unicode characters to be processed
Browse files Browse the repository at this point in the history
  • Loading branch information
avinash committed Dec 24, 2010
1 parent aaa44eb commit f4c3959
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ may or may not work.

Originally written by Derrick Childers and
[posted to macosxhints](http://www.macosxhints.com/article.php?story=20081108132735425).
Modifications by Guillaume Boudreau,
[Brian Morearty](http://github.com/BMorearty), and
[Mark Nottingham](http://github.com/mnot).
Modifications by Guillaume Boudreau,
[Brian Morearty](http://github.com/BMorearty),
[Mark Nottingham](http://github.com/mnot) and
[Avinash Meetoo](http://github.com/avinash)

Usage
-----
Expand Down Expand Up @@ -97,11 +98,13 @@ to set up:
Then, after downloading Pyexiv2 <http://tilloy.net/dev/pyexiv2/> and changing
into its source directory:

> sudo CXXFLAGS=-I"/opt/local/include" LDFLAGS="-L/opt/local/lib -lpython2.6" scons install
> export CXXFLAGS="-I/opt/local/include"
> export LDFLAGS="-L/opt/local/lib -lpython2.6"
> sudo scons install
> cd /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
> sudo mv libexiv2python.dylib libexiv2python.so

Note that you'll have to use python2.6 to run the script; e.g.,

> python2.6 exportiphoto ...


9 changes: 8 additions & 1 deletion exportiphoto.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
__version__ = "0.6"

import base64
import codecs
import locale
import os
import re
import shutil
Expand All @@ -20,6 +22,11 @@
except ImportError:
pyexiv2 = None

# To allow Unicode characters to be displayed
# (see http://wiki.python.org/moin/PrintFails)
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
sys.stderr = codecs.getwriter(locale.getpreferredencoding())(sys.stderr)

class iPhotoLibraryError(Exception):
pass

Expand Down Expand Up @@ -385,4 +392,4 @@ def copyImage(imageId, folderName, folderDate):
except iPhotoLibraryError, why:
error(why[0])
except KeyboardInterrupt:
error("Interrupted. Copy may be incomplete.")
error("Interrupted. Copy may be incomplete.")

0 comments on commit f4c3959

Please sign in to comment.