From 7323c8131f036d0c8bcc2ffa4fc859e1d749ef22 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Thu, 19 Mar 2009 09:45:16 +0100 Subject: Generic getter for all tags. --- src/exiv2wrapper.cpp | 1 + src/pyexiv2.py | 11 +++++++++++ 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/exiv2wrapper.cpp b/src/exiv2wrapper.cpp index 2aecf8d..3b1e229 100644 --- a/src/exiv2wrapper.cpp +++ b/src/exiv2wrapper.cpp @@ -456,6 +456,7 @@ void Image::setThumbnailFromJpegFile(const std::string path) } */ +// TODO: update the errors code to reflect changes from src/error.cpp in libexiv2 void translateExiv2Error(Exiv2::Error const& error) { // Use the Python 'C' API to set up an exception object diff --git a/src/pyexiv2.py b/src/pyexiv2.py index c64471a..9360b60 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -1022,6 +1022,17 @@ class ImageMetadata(object): self._tags['xmp'][key] = tag return tag + def get(self, key): + """ + Get a metadata tag for a given key. + DOCME + """ + family = key.split('.')[0].lower() + try: + return getattr(self, '_get_%s_tag' % family)(key) + except AttributeError: + raise KeyError(key) + class Image(libexiv2python.Image): -- cgit