diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2008-06-14 21:10:39 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2008-06-14 21:10:39 +0200 |
commit | e01497fc943963a82c7c84ef94798e6e43027198 (patch) | |
tree | af147e82452b19f252a92ad9a40503e196958969 /src | |
parent | 3a5641e021ec3b6314de359d72dea83ad906f7ea (diff) | |
download | pyexiv2-e01497fc943963a82c7c84ef94798e6e43027198.tar.gz |
First basic support for XMP metadata: listing XMP keys.
Diffstat (limited to 'src')
-rw-r--r-- | src/exiv2wrapper.cpp | 23 | ||||
-rw-r--r-- | src/exiv2wrapper.hpp | 3 | ||||
-rw-r--r-- | src/exiv2wrapper_python.cpp | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/src/exiv2wrapper.cpp b/src/exiv2wrapper.cpp index a0a69d5..3797b99 100644 --- a/src/exiv2wrapper.cpp +++ b/src/exiv2wrapper.cpp @@ -59,6 +59,7 @@ void Image::readMetadata() _image->readMetadata(); _exifData = _image->exifData(); _iptcData = _image->iptcData(); + _xmpData = _image->xmpData(); _dataRead = true; } @@ -68,6 +69,7 @@ void Image::readMetadata() { _image->setExifData(_exifData); _image->setIptcData(_iptcData); + _image->setXmpData(_xmpData); _image->writeMetadata(); } else @@ -322,9 +324,28 @@ boost::python::tuple Image::deleteIptcTag(std::string key, unsigned int index=0) } else throw Exiv2::Error(METADATA_NOT_READ); +}*/ + +boost::python::list Image::xmpKeys() +{ + boost::python::list keys; + if(_dataRead) + { + for(Exiv2::XmpMetadata::iterator i = _xmpData.begin(); + i != _xmpData.end(); + ++i) + { + keys.append(i->key()); + } + return keys; + } + else + { + throw Exiv2::Error(METADATA_NOT_READ); + } } -boost::python::tuple Image::tagDetails(std::string key) +/*boost::python::tuple Image::tagDetails(std::string key) { std::string keyFamily = key.substr(0, 4); if (keyFamily == "Exif") diff --git a/src/exiv2wrapper.hpp b/src/exiv2wrapper.hpp index 371cfe3..99929fc 100644 --- a/src/exiv2wrapper.hpp +++ b/src/exiv2wrapper.hpp @@ -122,6 +122,8 @@ public: // than the highest existing one. //boost::python::tuple deleteIptcTag(std::string key, unsigned int index); + boost::python::list xmpKeys(); + // Return a tuple containing the name of the tag and its description. //boost::python::tuple tagDetails(std::string key); @@ -154,6 +156,7 @@ private: Exiv2::Image::AutoPtr _image; Exiv2::ExifData _exifData; Exiv2::IptcData _iptcData; + Exiv2::XmpData _xmpData; // true if the image's internal metadata has already been read, // false otherwise diff --git a/src/exiv2wrapper_python.cpp b/src/exiv2wrapper_python.cpp index 3b431d9..1dd360c 100644 --- a/src/exiv2wrapper_python.cpp +++ b/src/exiv2wrapper_python.cpp @@ -54,6 +54,8 @@ BOOST_PYTHON_MODULE(libexiv2python) // .def("_Image__setIptcTag", &Image::setIptcTag) // .def("_Image__deleteIptcTag", &Image::deleteIptcTag) + .def("xmpKeys", &Image::xmpKeys) + // .def("tagDetails", &Image::tagDetails) // .def("getThumbnailData", &Image::getThumbnailData) |