|
|
@ -87,6 +87,7 @@ public:
|
|
|
|
bool dst;
|
|
|
|
bool dst;
|
|
|
|
bool dryrun;
|
|
|
|
bool dryrun;
|
|
|
|
bool ascii;
|
|
|
|
bool ascii;
|
|
|
|
|
|
|
|
bool remove;
|
|
|
|
|
|
|
|
|
|
|
|
Options()
|
|
|
|
Options()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -96,6 +97,7 @@ public:
|
|
|
|
dst = false;
|
|
|
|
dst = false;
|
|
|
|
dryrun = false;
|
|
|
|
dryrun = false;
|
|
|
|
ascii = false;
|
|
|
|
ascii = false;
|
|
|
|
|
|
|
|
remove = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
virtual ~Options() {} ;
|
|
|
|
virtual ~Options() {} ;
|
|
|
@ -113,6 +115,7 @@ enum // keyword indices
|
|
|
|
, kwDST
|
|
|
|
, kwDST
|
|
|
|
, kwDRYRUN
|
|
|
|
, kwDRYRUN
|
|
|
|
, kwASCII
|
|
|
|
, kwASCII
|
|
|
|
|
|
|
|
, kwREMOVE
|
|
|
|
, kwVERBOSE
|
|
|
|
, kwVERBOSE
|
|
|
|
, kwADJUST
|
|
|
|
, kwADJUST
|
|
|
|
, kwTZ
|
|
|
|
, kwTZ
|
|
|
@ -790,6 +793,7 @@ int main(int argc,const char* argv[])
|
|
|
|
keywords[kwADJUST ] = "adjust";
|
|
|
|
keywords[kwADJUST ] = "adjust";
|
|
|
|
keywords[kwTZ ] = "tz";
|
|
|
|
keywords[kwTZ ] = "tz";
|
|
|
|
keywords[kwDELTA ] = "delta";
|
|
|
|
keywords[kwDELTA ] = "delta";
|
|
|
|
|
|
|
|
keywords[kwREMOVE ] = "remove";
|
|
|
|
|
|
|
|
|
|
|
|
map<std::string,string> shorts;
|
|
|
|
map<std::string,string> shorts;
|
|
|
|
shorts["-?"] = "-help";
|
|
|
|
shorts["-?"] = "-help";
|
|
|
@ -803,6 +807,7 @@ int main(int argc,const char* argv[])
|
|
|
|
shorts["-s"] = "-delta";
|
|
|
|
shorts["-s"] = "-delta";
|
|
|
|
shorts["-X"] = "-dryrun";
|
|
|
|
shorts["-X"] = "-dryrun";
|
|
|
|
shorts["-a"] = "-ascii";
|
|
|
|
shorts["-a"] = "-ascii";
|
|
|
|
|
|
|
|
shorts["-r"] = "-remove";
|
|
|
|
|
|
|
|
|
|
|
|
Options options ;
|
|
|
|
Options options ;
|
|
|
|
options.help = sina(keywords[kwHELP ],argv) || argc < 2;
|
|
|
|
options.help = sina(keywords[kwHELP ],argv) || argc < 2;
|
|
|
@ -811,6 +816,7 @@ int main(int argc,const char* argv[])
|
|
|
|
options.version = sina(keywords[kwVERSION],argv);
|
|
|
|
options.version = sina(keywords[kwVERSION],argv);
|
|
|
|
options.dst = sina(keywords[kwDST ],argv);
|
|
|
|
options.dst = sina(keywords[kwDST ],argv);
|
|
|
|
options.ascii = sina(keywords[kwASCII ],argv);
|
|
|
|
options.ascii = sina(keywords[kwASCII ],argv);
|
|
|
|
|
|
|
|
options.remove = sina(keywords[kwASCII ],argv);
|
|
|
|
|
|
|
|
|
|
|
|
for ( int i = 1 ; !result && i < argc ; i++ ) {
|
|
|
|
for ( int i = 1 ; !result && i < argc ; i++ ) {
|
|
|
|
const char* arg = argv[i++];
|
|
|
|
const char* arg = argv[i++];
|
|
|
@ -831,6 +837,7 @@ int main(int argc,const char* argv[])
|
|
|
|
case kwDRYRUN : options.dryrun = true ; break;
|
|
|
|
case kwDRYRUN : options.dryrun = true ; break;
|
|
|
|
case kwVERBOSE : options.verbose = true ; break;
|
|
|
|
case kwVERBOSE : options.verbose = true ; break;
|
|
|
|
case kwASCII : options.ascii = true ; break;
|
|
|
|
case kwASCII : options.ascii = true ; break;
|
|
|
|
|
|
|
|
case kwREMOVE : options.remove = true ; break;
|
|
|
|
case kwTZ : Position::tz_ = parseTZ(value);break;
|
|
|
|
case kwTZ : Position::tz_ = parseTZ(value);break;
|
|
|
|
case kwADJUST : Position::adjust_ = ivalue;break;
|
|
|
|
case kwADJUST : Position::adjust_ = ivalue;break;
|
|
|
|
case kwDELTA : Position::deltaMax_ = ivalue;break;
|
|
|
|
case kwDELTA : Position::deltaMax_ = ivalue;break;
|
|
|
@ -881,8 +888,8 @@ int main(int argc,const char* argv[])
|
|
|
|
s-= m*60 ;
|
|
|
|
s-= m*60 ;
|
|
|
|
printf("tz,dst,adjust = %d,%d,%d total = %dsecs (= %d:%d:%d)\n",t,d,a,A,h,m,s);
|
|
|
|
printf("tz,dst,adjust = %d,%d,%d total = %dsecs (= %d:%d:%d)\n",t,d,a,A,h,m,s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
|
|
|
|
if ( options.verbose ) {
|
|
|
|
if ( options.verbose && gTimeDict.size() ) {
|
|
|
|
printf("Time Dictionary\n");
|
|
|
|
printf("Time Dictionary\n");
|
|
|
|
for ( TimeDict_i it = gTimeDict.begin() ; it != gTimeDict.end() ; it++ ) {
|
|
|
|
for ( TimeDict_i it = gTimeDict.begin() ; it != gTimeDict.end() ; it++ ) {
|
|
|
|
std::string sTime = getExifTime(it->first);
|
|
|
|
std::string sTime = getExifTime(it->first);
|
|
|
@ -894,7 +901,10 @@ int main(int argc,const char* argv[])
|
|
|
|
printf("%s %s\n",sTime.c_str(), sPos.c_str());
|
|
|
|
printf("%s %s\n",sTime.c_str(), sPos.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
if ( !gTimeDict.size() && gFiles.size() && !options.remove ) {
|
|
|
|
|
|
|
|
printf("nothing in time dictionary!\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
for ( size_t p = 0 ; p < gFiles.size() ; p++ ) {
|
|
|
|
for ( size_t p = 0 ; p < gFiles.size() ; p++ ) {
|
|
|
|
std::string path = gFiles[p] ;
|
|
|
|
std::string path = gFiles[p] ;
|
|
|
|
std::string stamp ;
|
|
|
|
std::string stamp ;
|
|
|
@ -905,8 +915,22 @@ int main(int argc,const char* argv[])
|
|
|
|
if ( image.get() ) {
|
|
|
|
if ( image.get() ) {
|
|
|
|
image->readMetadata();
|
|
|
|
image->readMetadata();
|
|
|
|
Exiv2::ExifData& exifData = image->exifData();
|
|
|
|
Exiv2::ExifData& exifData = image->exifData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if asked to remove, cycle the metadata and remove GPSInfo
|
|
|
|
|
|
|
|
// you can remove and geotag in the same run
|
|
|
|
|
|
|
|
// this is very useful when the TZ is incorrectly set to "clean" GPS before writing new data
|
|
|
|
|
|
|
|
if ( options.remove ) {
|
|
|
|
|
|
|
|
for (Exiv2::ExifData::iterator pos = exifData.begin(); pos != exifData.end(); ++pos) {
|
|
|
|
|
|
|
|
if ( pos->groupName() == "GPSInfo" ) {
|
|
|
|
|
|
|
|
if ( options.verbose ) {
|
|
|
|
|
|
|
|
std::cout << "remove: " << pos->key() << std::endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !options.dryrun ) exifData.erase(pos);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if ( pPos ) {
|
|
|
|
if ( pPos ) {
|
|
|
|
exifData["Exif.GPSInfo.GPSProcessingMethod" ] = "65 83 67 73 73 0 0 0 72 89 66 82 73 68 45 70 73 88"; // ASCII HYBRID-FIX
|
|
|
|
exifData["Exif.GPSInfo.GPSProcessingMethod" ] = "charset=Ascii HYBRID-FIX";
|
|
|
|
exifData["Exif.GPSInfo.GPSVersionID" ] = "2 2 0 0";
|
|
|
|
exifData["Exif.GPSInfo.GPSVersionID" ] = "2 2 0 0";
|
|
|
|
exifData["Exif.GPSInfo.GPSMapDatum" ] = "WGS-84";
|
|
|
|
exifData["Exif.GPSInfo.GPSMapDatum" ] = "WGS-84";
|
|
|
|
|
|
|
|
|
|
|
@ -924,7 +948,9 @@ int main(int argc,const char* argv[])
|
|
|
|
|
|
|
|
|
|
|
|
printf("%s %s % 2d\n",path.c_str(),pPos->toString().c_str(),pPos->delta());
|
|
|
|
printf("%s %s % 2d\n",path.c_str(),pPos->toString().c_str(),pPos->delta());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
printf("%s *** not in time dict ***\n",path.c_str());
|
|
|
|
if ( gTimeDict.size() ) {
|
|
|
|
|
|
|
|
printf("%s *** not in time dict ***\n",path.c_str());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !options.dryrun ) image->writeMetadata();
|
|
|
|
if ( !options.dryrun ) image->writeMetadata();
|
|
|
|
}
|
|
|
|
}
|
|
|
|