[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:20 UTC 2017


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

The following commit has been merged in the master branch:
commit 8ef1d8f854d59c63b3e654b2b85303e516d948f8
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Tue Dec 13 16:18:52 2005 +0000

    Added -c option to the exiv2 utility to set the Jpeg comment from a string given on the command line. Implements feature #446.
---
 src/actions.cpp          | 10 ++++++++++
 src/exiv2.1              | 11 +++++++----
 src/exiv2.cpp            | 13 +++++++++----
 src/exiv2.hpp            |  3 ++-
 test/data/exiv2-test.out |  5 +++--
 5 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/src/actions.cpp b/src/actions.cpp
index 19fd210..96a977f 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -1020,6 +1020,16 @@ namespace Action {
         assert(image_.get() != 0);
         image_->readMetadata();
 
+        if (!Params::instance().jpegComment_.empty()) {
+            if (Params::instance().verbose_) {
+                std::cout << "Setting Jpeg comment '" 
+                          << Params::instance().jpegComment_
+                          << "'" 
+                          << std::endl;
+            }
+            image_->setComment(Params::instance().jpegComment_);
+        }
+
         // loop through command table and apply each command
         ModifyCmds& modifyCmds = Params::instance().modifyCmds_;
         ModifyCmds::const_iterator i = modifyCmds.begin();
diff --git a/src/exiv2.1 b/src/exiv2.1
index 85883fd..e6c9834 100644
--- a/src/exiv2.1
+++ b/src/exiv2.1
@@ -54,7 +54,7 @@ Adjust EXIF timestamps by the given time. This action requires the option
 .TP
 .B mo | modify
 Apply commands to modify (add, set, delete) the EXIF/IPTC metadata of image
-files. Requires option 
B\-m
P or 
B\-M
P.
+files. Requires option 
B\-c
P, 
B\-m
P or 
B\-M
P.
 .TP
 .B mv | rename
 Rename files and/or set file timestamps according to the EXIF create
@@ -139,18 +139,21 @@ those for the 
B\-d
P option.
 Filename format for the 'rename' action. The format string follows
 
Bstrftime
P(3). Default filename format is %Y%m%d_%H%M%S.
 .TP
+.B \-c 
Itxt
P
+Jpeg comment string to set in the image ('modify' action).
+.TP
 .B \-m 
Ifile
P
-Command file for the modify action.
+Command file for the 'modify' action.
 .TP
 .B \-M 
Icmd
P
-Command line for the modify action. The format for the commands is the same
+Command line for the 'modify' action. The format for the commands is the same
 as that of the lines of a command file.
 .TP
 .B \-l 
Idir
P
 Location (directory) for files to be inserted or extracted.
 .TP
 .B \-S 
I.suf
P
-Use suffix 
I.suf
P for source files for insert command.
+Use suffix 
I.suf
P for source files in 'insert' action.
 .SH COMMANDS
 Commands for the 'modify' action can be read from a command file, e.g., 
 .sp 1
diff --git a/src/exiv2.cpp b/src/exiv2.cpp
index 9b71e90..e658fa4 100644
--- a/src/exiv2.cpp
+++ b/src/exiv2.cpp
@@ -197,8 +197,9 @@ void Params::help(std::ostream& os) const
        << "  mv | rename   Rename files and/or set file timestamps according to the
"
        << "                Exif create timestamp. The filename format can be set with
"
        << "                -r format, timestamp options are controlled with -t and -T.
"
-       << "  mo | modify   Apply commands to modify (add, set, delete) the Exif
"
-       << "                and Iptc metadata of image files. Requires option -m or -M.
"
+       << "  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.
"
        << "
Options:
"
        << "   -h      Display this help and exit.
"
        << "   -V      Show the program version and exit.
"
@@ -232,6 +233,7 @@ void Params::help(std::ostream& os) const
        << "   -r fmt  Filename format for the 'rename' action. The format string
"
        << "           follows strftime(3). Default filename format is "
        <<             format_ << ".
"
+       << "   -c txt  Jpeg comment string to set in the image.
"
        << "   -m file Command file for the modify action. The format for commands is
"
        << "           set|add|del <key> [[<type>] <value>].
"
        << "   -M cmd  Command line for the modify action. The format for the
"
@@ -258,6 +260,7 @@ int Params::option(int opt, const std::string& optarg, int optopt)
     case 'd': rc = evalDelete(optarg); break;
     case 'e': rc = evalExtract(optarg); break;
     case 'i': rc = evalInsert(optarg); break;
+    case 'c': rc = evalModify(opt, optarg); break;
     case 'm': rc = evalModify(opt, optarg); break;
     case 'M': rc = evalModify(opt, optarg); break;
     case 'l': directory_ = optarg; break;
@@ -458,6 +461,7 @@ int Params::evalModify(int opt, const std::string& optarg)
         action_ = Action::modify;
         // fallthrough
     case Action::modify:
+        if (opt == 'c') jpegComment_ = optarg; 
         if (opt == 'm') cmdFiles_.push_back(optarg);  // parse the files later
         if (opt == 'M') cmdLines_.push_back(optarg);  // parse the commands later
         break;
@@ -567,9 +571,10 @@ int Params::getopt(int argc, char* const argv[])
                   << ": Adjust action requires option -a time
";
         rc = 1;
     }
-    if (action_ == Action::modify && cmdFiles_.empty() && cmdLines_.empty()) {
+    if (   action_ == Action::modify 
+        && cmdFiles_.empty() && cmdLines_.empty() && jpegComment_.empty()) {
         std::cerr << progname()
-                  << ": Modify action requires at least one -m or -M option
";
+                  << ": Modify action requires at least one -c, -m or -M option
";
         rc = 1;
     }
     if (0 == files_.size()) {
diff --git a/src/exiv2.hpp b/src/exiv2.hpp
index 70462b0..6141212 100644
--- a/src/exiv2.hpp
+++ b/src/exiv2.hpp
@@ -149,6 +149,7 @@ public:
     CmdFiles cmdFiles_;                 //!< Names of the modification command files
     CmdLines cmdLines_;                 //!< Commands from the command line
     ModifyCmds modifyCmds_;             //!< Parsed modification commands
+    std::string jpegComment_;           //!< Jpeg comment to set in the image
     std::string directory_;             //!< Location for files to extract/insert
     std::string suffix_;                //!< File extension of the file to insert
     Files files_;                       //!< List of non-option arguments.
@@ -158,7 +159,7 @@ private:
       @brief Default constructor. Note that optstring_ is initialized here.
              The c'tor is private to force instantiation through instance().
      */
-    Params() : optstring_(":hVvfktTFa:r:p:d:e:i:m:M:l:S:"),
+    Params() : optstring_(":hVvfktTFa:r:p:d:e:i:c:m:M:l:S:"),
                help_(false),
                version_(false),
                verbose_(false),
diff --git a/test/data/exiv2-test.out b/test/data/exiv2-test.out
index 04711c9..6e2674e 100644
--- a/test/data/exiv2-test.out
+++ b/test/data/exiv2-test.out
@@ -24,8 +24,8 @@ Actions:
   mv | rename   Rename files and/or set file timestamps according to the
                 Exif create timestamp. The filename format can be set with
                 -r format, timestamp options are controlled with -t and -T.
-  mo | modify   Apply commands to modify (add, set, delete) the Exif
-                and Iptc metadata of image files. Requires option -m or -M.
+  mo | modify   Apply commands to modify (add, set, delete) the Exif and
+                Iptc metadata of image files. Requires option -c, -m or -M.
 
 Options:
    -h      Display this help and exit.
@@ -59,6 +59,7 @@ Options:
            are the same as those for the -d option.
    -r fmt  Filename format for the 'rename' action. The format string
            follows strftime(3). Default filename format is %Y%m%d_%H%M%S.
+   -c txt  Jpeg comment string to set in the image.
    -m file Command file for the modify action. The format for commands is
            set|add|del <key> [[<type>] <value>].
    -M cmd  Command line for the modify action. The format for the

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list