diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2007-10-10 23:01:24 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2007-10-10 23:01:24 +0200 |
commit | 401ba3ff3b23f3b3e1005418ce397651de09a936 (patch) | |
tree | aa3bc24f4d83aade41afadf2284fb09a3d0119f4 /src | |
parent | 5e436f033421072c9a2da13f2193398db8a7e89d (diff) | |
download | pyexiv2-401ba3ff3b23f3b3e1005418ce397651de09a936.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/libpyexiv2.cpp | 19 | ||||
-rw-r--r-- | src/libpyexiv2.hpp | 3 | ||||
-rw-r--r-- | src/libpyexiv2_wrapper.cpp | 2 |
3 files changed, 24 insertions, 0 deletions
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) diff --git a/src/libpyexiv2.hpp b/src/libpyexiv2.hpp index 736d1cf..4c867de 100644 --- a/src/libpyexiv2.hpp +++ b/src/libpyexiv2.hpp @@ -108,6 +108,9 @@ namespace LibPyExiv2 // than the highest existing one. boost::python::tuple deleteIptcTag(std::string key, unsigned int index); + // Return a tuple containing the name of the tag and its description. + boost::python::tuple tagDetails(std::string key); + // Read and write access to the thumbnail embedded in the image. // Return a tuple containing the format of the thumbnail ("TIFF" or diff --git a/src/libpyexiv2_wrapper.cpp b/src/libpyexiv2_wrapper.cpp index dc9152f..50519d4 100644 --- a/src/libpyexiv2_wrapper.cpp +++ b/src/libpyexiv2_wrapper.cpp @@ -54,6 +54,8 @@ BOOST_PYTHON_MODULE(libpyexiv2) .def("_Image__setIptcTag", &Image::setIptcTag) .def("_Image__deleteIptcTag", &Image::deleteIptcTag) + .def("tagDetails", &Image::tagDetails) + .def("getThumbnailData", &Image::getThumbnailData) .def("setThumbnailData", &Image::setThumbnailData) .def("deleteThumbnail", &Image::deleteThumbnail) |