aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-12-16 09:49:32 +0100
committerOlivier Tilloy <olivier@tilloy.net>2009-12-16 09:49:32 +0100
commit5ccd07b540af06588aae4f9c6dc5f1ae7f8722d0 (patch)
tree69c2f6eca1c71055be693749bee692327ff0805e /src
parentfe856c04808a1b40c0268e773ed8e8db155c6fb6 (diff)
downloadpyexiv2-5ccd07b540af06588aae4f9c6dc5f1ae7f8722d0.tar.gz
Fixed metadata unit tests.
Diffstat (limited to 'src')
-rw-r--r--src/pyexiv2/metadata.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/pyexiv2/metadata.py b/src/pyexiv2/metadata.py
index bfad292..6e10eb3 100644
--- a/src/pyexiv2/metadata.py
+++ b/src/pyexiv2/metadata.py
@@ -154,7 +154,7 @@ class ImageMetadata(object):
def _set_exif_tag(self, tag):
# Set an EXIF tag. If the tag already exists, its value is overwritten.
- if type(tag) is not ExifTag:
+ if not isinstance(tag, ExifTag):
raise TypeError('Expecting an ExifTag')
self._image.setExifTagValue(tag.key, str(tag))
self._tags['exif'][tag.key] = tag
@@ -175,7 +175,7 @@ class ImageMetadata(object):
def _set_iptc_tag(self, tag):
# Set an IPTC tag. If the tag already exists, its values are
# overwritten.
- if type(tag) is not IptcTag:
+ if not isinstance(tag, IptcTag):
raise TypeError('Expecting an IptcTag')
self._image.setIptcTagValues(tag.key, tag.to_string_list())
self._tags['iptc'][tag.key] = tag
@@ -199,9 +199,15 @@ class ImageMetadata(object):
def _set_xmp_tag(self, tag):
# Set an XMP tag. If the tag already exists, its value is overwritten.
- if type(tag) is not XmpTag:
+ if not isinstance(tag, XmpTag):
raise TypeError('Expecting an XmpTag')
- self._image.setXmpTagValue(tag.key, tag.to_string())
+ type = tag._tag._getExiv2Type()
+ if type == 'XmpText':
+ self._image.setXmpTagTextValue(tag.key, tag.raw_value)
+ elif type in ('XmpAlt', 'XmpBag', 'XmpSeq'):
+ self._image.setXmpTagArrayValue(tag.key, tag.raw_value)
+ elif type == 'LangAlt':
+ self._image.setXmpTagLangAltValue(tag.key, tag.raw_value)
self._tags['xmp'][tag.key] = tag
tag.metadata = self