[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:36:15 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=4bc4a0d
The following commit has been merged in the master branch:
commit 4bc4a0dc400d108f0fa97c2a0bd2b6e53634d9fa
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Fri Apr 2 09:53:14 2004 +0000
Added Task Insert, implemented extract and insert functionality
---
src/actions.cpp | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
src/actions.hpp | 22 +++++++++++++++---
2 files changed, 81 insertions(+), 11 deletions(-)
diff --git a/src/actions.cpp b/src/actions.cpp
index 90422e0..9c19543 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -20,13 +20,13 @@
*/
/*
File: actions.cpp
- Version: $Name: $ $Revision: 1.12 $
+ Version: $Name: $ $Revision: 1.13 $
Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
History: 08-Dec-03, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name: $ $Revision: 1.12 $ $RCSfile: actions.cpp,v $")
+EXIV2_RCSID("@(#) $Name: $ $Revision: 1.13 $ $RCSfile: actions.cpp,v $")
// *****************************************************************************
// included header files
@@ -105,6 +105,7 @@ namespace Action {
registerTask(rename, Task::AutoPtr(new Rename));
registerTask(erase, Task::AutoPtr(new Erase));
registerTask(extract, Task::AutoPtr(new Extract));
+ registerTask(insert, Task::AutoPtr(new Insert));
} // TaskFactory c'tor
Task::AutoPtr TaskFactory::create(TaskType type)
@@ -504,11 +505,25 @@ namespace Action {
return 1;
} // Extract::run
- int Extract::writeExifData(const Exif::ExifData& exifData) const
+ int Extract::writeExifData(Exif::ExifData& exifData) const
{
- // Todo: implement me!
- std::cout << "Sorry, the extract action for Exif data has not been implemented yet.
";
- return 0;
+ std::string exvPath = Util::dirname(path_) + "/"
+ + Util::basename(path_, true) + ".exv";
+ if (Params::instance().verbose_) {
+ std::cout << "Writing Exif data to " << exvPath << "
";
+ }
+ if (!Params::instance().force_ && Util::fileExists(exvPath)) {
+ std::cout << Params::instance().progname()
+ << ": Overwrite `" << exvPath << "'? ";
+ std::string s;
+ std::cin >> s;
+ if (s[0] != 'y' && s[0] != 'Y') return 0;
+ }
+ int rc = exifData.writeExifData(exvPath);
+ if (rc) {
+ std::cerr << exifWriteError(rc, exvPath) << "
";
+ }
+ return rc;
}
int Extract::writeThumbnail(const Exif::ExifData& exifData) const
@@ -535,6 +550,9 @@ namespace Action {
if (s[0] != 'y' && s[0] != 'Y') return 0;
}
int rc = exifData.writeThumbnail(thumb);
+ if (rc) {
+ std::cerr << exifWriteError(rc, thumb) << "
";
+ }
return rc;
}
@@ -548,6 +566,42 @@ namespace Action {
return new Extract(*this);
}
+ int Insert::run(const std::string& path)
+ try {
+ std::string exvPath = Util::dirname(path) + "/"
+ + Util::basename(path, true) + ".exv";
+ Exif::ExifData exifData;
+ int rc = exifData.read(exvPath);
+ if (rc) {
+ std::cerr << exifReadError(rc, exvPath) << "
";
+ return rc;
+ }
+ if (Params::instance().verbose_) {
+ std::cout << "Inserting metadata from " << exvPath << "
";
+ }
+ rc = exifData.write(path);
+ if (rc) {
+ std::cerr << exifWriteError(rc, path) << "
";
+ }
+ return rc;
+ }
+ catch(const Exif::Error& e)
+ {
+ std::cerr << "Exif exception in insert action for file " << path
+ << ":
" << e << "
";
+ return 1;
+ } // Insert::run
+
+ Insert::AutoPtr Insert::clone() const
+ {
+ return AutoPtr(dynamic_cast<Insert*>(clone_()));
+ }
+
+ Task* Insert::clone_() const
+ {
+ return new Insert(*this);
+ }
+
int Adjust::run(const std::string& path)
try {
adjustment_ = Params::instance().adjustment_;
@@ -681,7 +735,7 @@ namespace {
std::string error;
switch (rc) {
case -1:
- error = "Couldn't open file `" + path + "'";
+ error = "Failed to open file `" + path + "'";
break;
case -2:
error = "The file contains data of an unknown image type";
@@ -710,7 +764,7 @@ namespace {
std::string error;
switch (rc) {
case -1:
- error = "Couldn't open file `" + path + "'";
+ error = "Failed to open file `" + path + "'";
break;
case -2:
error = "The file contains data of an unknown image type";
diff --git a/src/actions.hpp b/src/actions.hpp
index 6b6fc7d..042521a 100644
--- a/src/actions.hpp
+++ b/src/actions.hpp
@@ -22,7 +22,7 @@
@file actions.hpp
@brief Implements base class Task, TaskFactory and the various supported
actions (derived from Task).
- @version $Name: $ $Revision: 1.5 $
+ @version $Name: $ $Revision: 1.6 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
@date 11-Dec-03, ahu: created
@@ -52,7 +52,7 @@ namespace Exif {
namespace Action {
//! Enumerates all tasks
- enum TaskType { none, adjust, print, rename, erase, extract };
+ enum TaskType { none, adjust, print, rename, erase, extract, insert };
// *****************************************************************************
// class definitions
@@ -250,13 +250,29 @@ namespace Action {
@brief Write the %Exif data to a file. The filename is composed by
replacing the suffix of the image filename with ".exf".
*/
- int writeExifData(const Exif::ExifData& exifData) const;
+ int writeExifData(Exif::ExifData& exifData) const;
private:
virtual Task* clone_() const;
std::string path_;
}; // class Extract
+
+ /*!
+ @brief %Insert the %Exif data from corresponding *.exv files.
+ */
+ class Insert : public Task {
+ public:
+ virtual ~Insert() {}
+ virtual int run(const std::string& path);
+ typedef std::auto_ptr<Insert> AutoPtr;
+ AutoPtr clone() const;
+
+ private:
+ virtual Task* clone_() const;
+
+ }; // class Insert
+
} // namespace Action
#endif // #ifndef ACTIONS_HPP_
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list