aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-11-27 09:50:31 +0100
committerOlivier Tilloy <olivier@tilloy.net>2009-11-27 09:50:31 +0100
commite6420bea5b2fec03326a8ffb863e0f267b320ee0 (patch)
tree772d4b40f940a871e00465367ccf352b8a2949dd /src
parentcd41bb7689f249d8274db8aff0d9b8b65ca860e3 (diff)
downloadpyexiv2-e6420bea5b2fec03326a8ffb863e0f267b320ee0.tar.gz
XMP text value to Rational conversion.
Diffstat (limited to 'src')
-rw-r--r--src/pyexiv2/xmp.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pyexiv2/xmp.py b/src/pyexiv2/xmp.py
index c66a754..f2f9d2e 100644
--- a/src/pyexiv2/xmp.py
+++ b/src/pyexiv2/xmp.py
@@ -26,7 +26,7 @@
import libexiv2python
-from pyexiv2.utils import FixedOffset
+from pyexiv2.utils import FixedOffset, Rational
import datetime
import re
@@ -247,6 +247,12 @@ class XmpTag(object):
except ValueError:
raise XmpValueError(value, type)
+ elif type == 'Rational':
+ try:
+ return Rational.from_string(value)
+ except (ValueError, ZeroDivisionError):
+ raise XmpValueError(value, type)
+
elif type == 'Real':
# TODO
raise NotImplementedError('XMP conversion for type [%s]' % type)