Rename action: Use Exif.Image.DateTime if Exif.Photo.DateTimeOriginal is not present.

v0.27.3
Andreas Huggel 18 years ago
parent 26e95799d0
commit 755bb63ef0

@ -775,14 +775,19 @@ namespace Action {
Exiv2::ExifKey key("Exif.Photo.DateTimeOriginal"); Exiv2::ExifKey key("Exif.Photo.DateTimeOriginal");
Exiv2::ExifData::iterator md = exifData.findKey(key); Exiv2::ExifData::iterator md = exifData.findKey(key);
if (md == exifData.end()) { if (md == exifData.end()) {
std::cerr << _("Metadatum with key") << " `" << key << "' " key = Exiv2::ExifKey("Exif.Image.DateTime");
<< _("not found in the file") << " " << path << "\n"; md = exifData.findKey(key);
}
if (md == exifData.end()) {
std::cerr << _("Neither tag") << " `Exif.Photo.DateTimeOriginal' "
<< _("nor") << " `Exif.Image.DateTime' "
<< _("found in the file") << " " << path << "\n";
return 1; return 1;
} }
std::string v = md->toString(); std::string v = md->toString();
if (v.length() == 0 || v[0] == ' ') { if (v.length() == 0 || v[0] == ' ') {
std::cerr << _("Image file creation timestamp not set in the file") << " " std::cerr << _("Image file creation timestamp not set in the file")
<< path << "\n"; << " " << path << "\n";
return 1; return 1;
} }
struct tm tm; struct tm tm;

@ -3,7 +3,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH EXIV2 1 "February 25th, 2007" .TH EXIV2 1 "June 3rd, 2007"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -65,8 +65,10 @@ files. Requires option \fB\-c\fP, \fB\-m\fP or \fB\-M\fP.
.TP .TP
.B mv | rename .B mv | rename
Rename files and/or set file timestamps according to the Exif create Rename files and/or set file timestamps according to the Exif create
timestamp. The filename format can be set with \fB\-r\fP \fIfmt\fP, timestamp. Uses the value of tag Exif.Photo.DateTimeOriginal or, if
timestamp options are \fB\-t\fP and \fB\-T\fP. not present, Exif.Image.DateTime to determine the timestamp. The
filename format can be set with \fB\-r\fP \fIfmt\fP, timestamp options
are \fB\-t\fP and \fB\-T\fP.
.TP .TP
.B fi | fixiso .B fi | fixiso
Copy the ISO setting from any of the proprietary Nikon makernote ISO Copy the ISO setting from any of the proprietary Nikon makernote ISO

Loading…
Cancel
Save