[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:38:06 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=db5426a
The following commit has been merged in the master branch:
commit db5426a29e8a6339893471a92dc552b76944b08d
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Thu Nov 16 14:42:38 2006 +0000
Added RenameAddon1.diff patch from Tobias Jahn, fixes bug #459.
---
src/actions.cpp | 7 ++++++-
src/exiv2.1 | 21 ++++++++++++++++-----
src/exiv2.cpp | 7 +++++--
src/utils.cpp | 10 ++++++++++
src/utils.hpp | 6 ++++++
test/data/exiv2-test.out | 8 ++++++--
6 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/src/actions.cpp b/src/actions.cpp
index 9314708..d8997f7 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -1560,10 +1560,15 @@ namespace {
int renameFile(std::string& newPath, const struct tm* tm)
{
std::string path = newPath;
+ std::string format = Params::instance().format_;
+ Util::replace(format, ":basename:", Util::basename(path, true));
+ Util::replace(format, ":dirname:", Util::basename(Util::dirname(path)));
+ Util::replace(format, ":parentname:", Util::basename(Util::dirname(Util::dirname(path))));
+
const size_t max = 1024;
char basename[max];
memset(basename, 0x0, max);
- if (strftime(basename, max, Params::instance().format_.c_str(), tm) == 0) {
+ if (strftime(basename, max, format.c_str(), tm) == 0) {
std::cerr << "Filename format yields empty filename for the file "
<< path << "
";
return 1;
diff --git a/src/exiv2.1 b/src/exiv2.1
index 6ac1346..893c617 100644
--- a/src/exiv2.1
+++ b/src/exiv2.1
@@ -3,7 +3,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
-.TH EXIV2 1 "September 12th, 2006"
+.TH EXIV2 1 "November 16th, 2006"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@@ -181,7 +181,15 @@ as those for the
B\-d
P option.
.TP
.B \-r
Ifmt
P
Filename format for the 'rename' action. The format string follows
-
Bstrftime
P(3). Default filename format is %Y%m%d_%H%M%S.
+
Bstrftime
P(3) and supports the following keywords:
+.br
+:basename: - original filename without extension
+.br
+:dirname: - name of the directory holding the original file
+.br
+:parentname: - name of parent directory
+.br
+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).
@@ -283,8 +291,11 @@ Prints a summary of the Exif information for all JPEG files in the directory.
exiv2 -pi image.jpg
Prints the IPTC metadata of the image.
.TP
-exiv2 rename image.jpg
-Renames image.jpg (taken on 13\-Nov\-05 at 22:58:31) to 20051113_225831.jpg
+exiv2 rename img_1234.jpg
+Renames img_1234.jpg (taken on 13\-Nov\-05 at 22:58:31) to 20051113_225831.jpg
+.TP
+exiv2 -r':basename:_%Y%m' rename img_1234.jpg
+Renames img_1234.jpg to img_1234_200511.jpg
.TP
exiv2 ex img1.jpg img2.jpg
Extracts metadata from the two files into files img1.exv and img2.exv.
@@ -327,7 +338,7 @@ Sample command file.
.TP
.I http://www.exiv2.org/metadata.html
Taglists with
Ikey
P and default
Itype
P values.
-.SH AUTHOR
+.SH AUTHORS
.B exiv2
was written by Andreas HUGGEL <ahuggel at gmx.net>.
.PP
diff --git a/src/exiv2.cpp b/src/exiv2.cpp
index 26482a3..ed0e8f9 100644
--- a/src/exiv2.cpp
+++ b/src/exiv2.cpp
@@ -259,8 +259,11 @@ void Params::help(std::ostream& os) const
<< " -e tgt Extract target(s) for the 'extract' action. Possible targets
"
<< " 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 "
- << format_ << ".
"
+ << " follows strftime(3). The following keywords are supported:
"
+ << " :basename: - original filename without extension
"
+ << " :dirname: - name of the directory holding the original file
"
+ << " :parentname: - name of parent directory
"
+ << " 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>].
"
diff --git a/src/utils.cpp b/src/utils.cpp
index 8a369d9..c70b27a 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -143,4 +143,14 @@ namespace Util {
return true;
}
+ void replace(std::string& text, const std::string& searchText, const std::string& replaceText)
+ {
+ std::string::size_type index = 0;
+ while ((index = text.find(searchText, index)) != std::string::npos)
+ {
+ text.replace(index, searchText.length(), replaceText.c_str(), replaceText.length());
+ index++;
+ }
+ }
+
} // namespace Util
diff --git a/src/utils.hpp b/src/utils.hpp
index 95be2bf..f721813 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -160,6 +160,12 @@ private:
*/
bool strtol(const char* nptr, long& n);
+ /*!
+ @brief Replaces all occurences of \em searchText in the \em text string
+ by \em replaceText.
+ */
+ void replace(std::string& text, const std::string& searchText, const std::string& replaceText);
+
} // namespace Util
#endif // #ifndef UTILS_HPP_
diff --git a/test/data/exiv2-test.out b/test/data/exiv2-test.out
index 181cfe5..c713a6f 100644
--- a/test/data/exiv2-test.out
+++ b/test/data/exiv2-test.out
@@ -22,7 +22,7 @@ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
Exiv2 help ---------------------------------------------------------------
-Usage: exiv2 [ options ] [ action ] file ...
+Usage: lt-exiv2 [ options ] [ action ] file ...
Manipulate the Exif metadata of images.
@@ -88,7 +88,11 @@ Options:
-e tgt Extract target(s) for the 'extract' action. Possible targets
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.
+ follows strftime(3). The following keywords are supported:
+ :basename: - original filename without extension
+ :dirname: - name of the directory holding the original file
+ :parentname: - name of parent directory
+ 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>].
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list