From 401ba3ff3b23f3b3e1005418ce397651de09a936 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Wed, 10 Oct 2007 23:01:24 +0200 Subject: Implemented feature request tracked by bug #149212 (Add access to tag labels): added method tagDetails(key) to class Image that returns a tuple containg the tag name and its description. --- src/libpyexiv2.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/libpyexiv2.cpp') diff --git a/src/libpyexiv2.cpp b/src/libpyexiv2.cpp index 06c6d54..96b9ba1 100644 --- a/src/libpyexiv2.cpp +++ b/src/libpyexiv2.cpp @@ -285,6 +285,25 @@ namespace LibPyExiv2 throw Exiv2::Error(METADATA_NOT_READ); } + boost::python::tuple Image::tagDetails(std::string key) + { + std::string keyFamily = key.substr(0, 4); + if (keyFamily == "Exif") + { + Exiv2::ExifKey exifKey = Exiv2::ExifKey(key); + std::string tagLabel = exifKey.tagLabel(); + std::string tagDesc = std::string(Exiv2::ExifTags::tagDesc(exifKey.tag(), exifKey.ifdId())); + return boost::python::make_tuple(tagLabel, tagDesc); + } + else if (keyFamily == "Iptc") + { + Exiv2::IptcKey iptcKey = Exiv2::IptcKey(key); + std::string tagLabel = iptcKey.tagLabel(); + std::string tagDesc = std::string(Exiv2::IptcDataSets::dataSetDesc(iptcKey.tag(), iptcKey.record())); + return boost::python::make_tuple(tagLabel, tagDesc); + } + } + boost::python::tuple Image::getThumbnailData() { if(_dataRead) -- cgit