[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:37:23 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=b953a4e

The following commit has been merged in the master branch:
commit b953a4e9da72035964ed8ecfe0e4844325d6afe3
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Wed Jan 25 06:48:44 2006 +0000

    Added fixiso action. Implements feature #450.
---
 src/actions.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/actions.hpp | 20 ++++++++++++++++++-
 src/exiv2.1     |  5 +++++
 src/exiv2.cpp   | 11 ++++++++++
 4 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/src/actions.cpp b/src/actions.cpp
index 7c4834a..47b007e 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -178,6 +178,7 @@ namespace Action {
         registerTask(extract, Task::AutoPtr(new Extract));
         registerTask(insert,  Task::AutoPtr(new Insert));
         registerTask(modify,  Task::AutoPtr(new Modify));
+        registerTask(fixiso,  Task::AutoPtr(new FixIso));
     } // TaskFactory c'tor
 
     Task::AutoPtr TaskFactory::create(TaskType type)
@@ -1252,6 +1253,67 @@ namespace Action {
         return 0;
     } // Adjust::adjustDateTime
 
+    int FixIso::run(const std::string& path)
+    try {
+        if (!Exiv2::fileExists(path, true)) {
+            std::cerr << path
+                      << ": Failed to open the file
";
+            return -1;
+        }
+        Timestamp ts;
+        if (Params::instance().preserve_) {
+            ts.read(path);
+        }
+        Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
+        assert(image.get() != 0);
+        image->readMetadata();
+        Exiv2::ExifData &exifData = image->exifData();
+        if (exifData.empty()) {
+            std::cerr << path
+                      << ": No Exif data found in the file
";
+            return -3;
+        }
+        Exiv2::ExifKey key("Exif.Nikon3.ISOSpeed");
+        Exiv2::ExifData::iterator md = exifData.findKey(key);
+        if (md == exifData.end()) {
+            key = Exiv2::ExifKey("Exif.Nikon2.ISOSpeed");
+            md = exifData.findKey(key);
+        }
+        if (md == exifData.end()) {
+            key = Exiv2::ExifKey("Exif.Nikon1.ISOSpeed");
+            md = exifData.findKey(key);
+        }
+        if (md != exifData.end()) {
+            std::ostringstream os;
+            os << *md;
+            if (Params::instance().verbose_) {
+                std::cout << "Setting Exif ISO value to " << os.str() << "
";
+            }
+            exifData["Exif.Photo.ISOSpeedRatings"] = os.str();
+        }
+        image->writeMetadata();
+        if (Params::instance().preserve_) {
+            ts.touch(path);
+        }
+        return 0;
+    }
+    catch(const Exiv2::AnyError& e)
+    {
+        std::cerr << "Exiv2 exception in fixiso action for file " << path
+                  << ":
" << e << "
";
+        return 1;
+    } // FixIso::run
+
+    FixIso::AutoPtr FixIso::clone() const
+    {
+        return AutoPtr(clone_());
+    }
+
+    FixIso* FixIso::clone_() const
+    {
+        return new FixIso(*this);
+    }
+
 }                                       // namespace Action
 
 // *****************************************************************************
diff --git a/src/actions.hpp b/src/actions.hpp
index e12c5c2..83b29a8 100644
--- a/src/actions.hpp
+++ b/src/actions.hpp
@@ -58,7 +58,8 @@ namespace Exiv2 {
 namespace Action {
 
     //! Enumerates all tasks
-    enum TaskType { none, adjust, print, rename, erase, extract, insert, modify };
+    enum TaskType { none, adjust, print, rename, erase, extract, insert, 
+                    modify, fixiso };
 
 // *****************************************************************************
 // class definitions
@@ -327,6 +328,23 @@ namespace Action {
         Exiv2::Image::AutoPtr image_;        //!< Image to modify
     }; // class Modify
 
+    /*!
+      @brief %Copy ISO settings from any of the Nikon makernotes to the
+             regular Exif tag, Exif.Photo.ISOSpeedRatings.
+     */
+    class FixIso : public Task {
+    public:
+        virtual ~FixIso() {}
+        virtual int run(const std::string& path);
+        typedef std::auto_ptr<FixIso> AutoPtr;
+        AutoPtr clone() const;
+
+    private:
+        virtual FixIso* clone_() const;
+        std::string path_;
+
+    }; // class FixIso
+
 }                                       // namespace Action
 
 #endif                                  // #ifndef ACTIONS_HPP_
diff --git a/src/exiv2.1 b/src/exiv2.1
index 694d244..40f437a 100644
--- a/src/exiv2.1
+++ b/src/exiv2.1
@@ -62,6 +62,11 @@ files. Requires option 
B\-c
P, 
B\-m
P or 
B\-M
P.
 Rename files and/or set file timestamps according to the EXIF create
 timestamp. The filename format can be set with 
B\-r
P 
Ifmt
P,
 timestamp options are 
B\-t
P and 
B\-T
P.
+.TP
+.B fi | fixiso
+Copy the ISO setting from any of the proprietary Nikon makernote ISO
+tags to the regular Exif ISO tag, Exif.Photo.ISOSpeedRatings. Overwrites 
+an existing Exif ISO tag.
 .SH OPTIONS
 .TP
 .B \-h
diff --git a/src/exiv2.cpp b/src/exiv2.cpp
index 1a35b91..b8c6108 100644
--- a/src/exiv2.cpp
+++ b/src/exiv2.cpp
@@ -212,6 +212,8 @@ void Params::help(std::ostream& os) const
        << "  mo | modify   Apply commands to modify (add, set, delete) the Exif and
"
        << "                Iptc metadata of image files or set the Jpeg comment.
"
        << "                Requires option -c, -m or -M.
"
+       << "  fi | fixiso   Copy ISO setting from the Nikon Makernote to the regular
"
+       << "                Exif tag.
"
        << "
Options:
"
        << "   -h      Display this help and exit.
"
        << "   -V      Show the program version and exit.
"
@@ -557,6 +559,15 @@ int Params::nonoption(const std::string& argv)
             action = true;
             action_ = Action::modify;
         }
+        if (argv == "fi" || argv == "fixiso") {
+            if (action_ != Action::none && action_ != Action::fixiso) {
+                std::cerr << progname() << ": Action fixiso is not "
+                          << "compatible with the given options
";
+                rc = 1;
+            }
+            action = true;
+            action_ = Action::fixiso;
+        }
         if (action_ == Action::none) {
             // if everything else fails, assume print as the default action
             action_ = Action::print;

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list