aboutsummaryrefslogtreecommitdiffstats
path: root/src/pyexiv2.py
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-01-22 21:24:38 +0100
committerOlivier Tilloy <olivier@tilloy.net>2009-01-22 21:24:38 +0100
commitc3d4e471123d05d297e43921121fc9fbce8cb8da (patch)
tree5897a4307030fce20e46eab21b6ed4db518ae6ff /src/pyexiv2.py
parentec5e7507e774d9b246453ab8bdabf338a54f873b (diff)
downloadpyexiv2-c3d4e471123d05d297e43921121fc9fbce8cb8da.tar.gz
Unit tests for XMP integer conversion.
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r--src/pyexiv2.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py
index 7a4d217..a2b2aef 100644
--- a/src/pyexiv2.py
+++ b/src/pyexiv2.py
@@ -497,6 +497,7 @@ class XmpTag(MetadataTag):
Return the value unchanged if the conversion fails.
"""
# TODO: use try except blocks and logging to log conversion errors
+
if xtype == 'Boolean':
if value == 'True':
return True
@@ -504,6 +505,7 @@ class XmpTag(MetadataTag):
return False
else:
return value
+
elif xtype == 'Choice':
# TODO
return value
@@ -550,14 +552,20 @@ class XmpTag(MetadataTag):
elif xtype == 'Font':
# TODO
return value
+
elif xtype == 'Integer':
- return int(value)
+ try:
+ return int(value)
+ except:
+ return value
+
elif xtype == 'Lang Alt':
# TODO
return value
elif xtype == 'Locale':
# TODO
return value
+
elif xtype == 'MIMEType':
try:
mtype, msubtype = value.split('/', 1)
@@ -565,6 +573,7 @@ class XmpTag(MetadataTag):
return value
else:
return {'type': mtype, 'subtype': msubtype}
+
elif xtype == 'ProperName':
# TODO
return value