aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Tilloy <osomon@sanctuary>2008-01-16 22:04:49 +0100
committerOlivier Tilloy <osomon@sanctuary>2008-01-16 22:04:49 +0100
commit766426fa74e5c267d23e4ae5f20e32654f30554a (patch)
tree69c857a83ff146ae62616cc302df454e671bf052
parent7fb82328d1edfe56b70c1bbd7f9fa26a31096a7e (diff)
downloadpyexiv2-766426fa74e5c267d23e4ae5f20e32654f30554a.tar.gz
Implemented feature request tracked by bug #175069 (Retrieve/set the JPEG comment): added methods getComment(), setComment(str) and clearComment() to class Image.
-rw-r--r--src/libpyexiv2.cpp30
-rw-r--r--src/libpyexiv2.hpp11
-rw-r--r--src/libpyexiv2_wrapper.cpp5
-rw-r--r--todo2
4 files changed, 47 insertions, 1 deletions
diff --git a/src/libpyexiv2.cpp b/src/libpyexiv2.cpp
index 96b9ba1..040e060 100644
--- a/src/libpyexiv2.cpp
+++ b/src/libpyexiv2.cpp
@@ -378,6 +378,36 @@ namespace LibPyExiv2
throw Exiv2::Error(METADATA_NOT_READ);
}
+ const std::string Image::getComment() const
+ {
+ if(_dataRead)
+ {
+ return _image->comment();
+ }
+ else
+ throw Exiv2::Error(METADATA_NOT_READ);
+ }
+
+ void Image::setComment(const std::string& comment)
+ {
+ if(_dataRead)
+ {
+ _image->setComment(comment);
+ }
+ else
+ throw Exiv2::Error(METADATA_NOT_READ);
+ }
+
+ void Image::clearComment()
+ {
+ if(_dataRead)
+ {
+ _image->clearComment();
+ }
+ else
+ throw Exiv2::Error(METADATA_NOT_READ);
+ }
+
void translateExiv2Error(Exiv2::Error const& e)
{
// Use the Python 'C' API to set up an exception object
diff --git a/src/libpyexiv2.hpp b/src/libpyexiv2.hpp
index 4c867de..a4175b7 100644
--- a/src/libpyexiv2.hpp
+++ b/src/libpyexiv2.hpp
@@ -135,6 +135,17 @@ namespace LibPyExiv2
// the thumbnail of the image.
void setThumbnailFromJpegFile(const std::string path);
+ // Read and write access to the JPEG comment embedded in the image.
+
+ // Get the JPEG comment contained in the image as a string.
+ const std::string getComment() const;
+
+ // Set the JPEG comment of the image.
+ void setComment(const std::string& comment);
+
+ // Clear the JPEG comment of the image (set it to an empty string).
+ void clearComment();
+
private:
std::string _filename;
Exiv2::Image::AutoPtr _image;
diff --git a/src/libpyexiv2_wrapper.cpp b/src/libpyexiv2_wrapper.cpp
index 50519d4..783c696 100644
--- a/src/libpyexiv2_wrapper.cpp
+++ b/src/libpyexiv2_wrapper.cpp
@@ -61,5 +61,10 @@ BOOST_PYTHON_MODULE(libpyexiv2)
.def("deleteThumbnail", &Image::deleteThumbnail)
.def("dumpThumbnailToFile", &Image::dumpThumbnailToFile)
.def("setThumbnailFromJpegFile", &Image::setThumbnailFromJpegFile)
+
+ .def("getComment", &Image::getComment)
+ .def("setComment", &Image::setComment)
+ .def("clearComment", &Image::clearComment)
;
}
+
diff --git a/todo b/todo
index da39526..04e6424 100644
--- a/todo
+++ b/todo
@@ -2,9 +2,9 @@ todo list
- Tag getters/setters should support unicode strings as well as regular strings (see bug #146313).
- What about forcing all strings encoding to UTF in tag values? (see Marc's mail)
-- Add support for JpegComment getters/setters
- Reflect changes from src/error.cpp in libexiv2 to src/libpyexiv2.cpp: new error messages, error codes changed
- Add a 'doc' builder to the SConstruct to build the module's documentation
- Rewrite the exiv2 command-line tool and the test binaries in Python and (Python) scripts to run the same tests that are run to test exiv2
- Write a complete documentation for the binding and it uses
- Write unit tests (http://docs.python.org/lib/module-unittest.html)
+- New architecture and support of XMP metadata (see bug #183337)