1
0
Fork 0
mirror of https://gitlab.com/Syping/gta5view-cmd synced 2024-11-21 13:10:23 +01:00

add auto extension

This commit is contained in:
Syping 2017-10-11 11:34:38 +02:00
parent f51b22691e
commit e3e56955e0

View file

@ -76,8 +76,7 @@ int main(int argc, char *argv[])
picture.setPictureTitle("Converted Picture"); picture.setPictureTitle("Converted Picture");
SnapmaticProperties pictureSP = picture.getSnapmaticProperties(); SnapmaticProperties pictureSP = picture.getSnapmaticProperties();
pictureSP.uid = QString(QTime::currentTime().toString("HHmmss") + pictureSP.uid = QString(QTime::currentTime().toString("HHmmss") +
QString("0") + QString::number(QDate::currentDate().dayOfYear())).toInt();
QString::number(QDate::currentDate().dayOfYear())).toInt();
pictureSP.createdDateTime = QDateTime::currentDateTime(); pictureSP.createdDateTime = QDateTime::currentDateTime();
pictureSP.createdTimestamp = pictureSP.createdDateTime.toTime_t(); pictureSP.createdTimestamp = pictureSP.createdDateTime.toTime_t();
picture.setSnapmaticProperties(pictureSP); picture.setSnapmaticProperties(pictureSP);
@ -86,19 +85,29 @@ int main(int argc, char *argv[])
filePath.replace("<autodef>", picture.getPictureFileName()); filePath.replace("<autodef>", picture.getPictureFileName());
if (!customFormat) if (!customFormat)
{ {
filePath.replace("<autoext>", "");
if (!picture.exportPicture(filePath, SnapmaticFormat::PGTA_Format)) if (!picture.exportPicture(filePath, SnapmaticFormat::PGTA_Format))
{ {
cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << args.at(2).toStdString().c_str() << " failed!" << endl; cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << filePath.toStdString().c_str() << " failed!" << endl;
return 1; return 1;
} }
else
{
cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << filePath.toStdString().c_str() << " successful!" << endl;
}
} }
else else
{ {
filePath.replace("<autoext>", ".g5e");
if (!picture.exportPicture(filePath, SnapmaticFormat::G5E_Format)) if (!picture.exportPicture(filePath, SnapmaticFormat::G5E_Format))
{ {
cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << args.at(2).toStdString().c_str() << " failed!" << endl; cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << filePath.toStdString().c_str() << " failed!" << endl;
return 1; return 1;
} }
else
{
cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << filePath.toStdString().c_str() << " successful!" << endl;
}
} }
} }
else else
@ -126,7 +135,8 @@ int main(int argc, char *argv[])
cout << "Usage: " << args.at(0).toStdString().c_str() << " source target -format" << endl; cout << "Usage: " << args.at(0).toStdString().c_str() << " source target -format" << endl;
if (args.at(1) == "--help") if (args.at(1) == "--help")
{ {
cout << "Convert-only: <autodef> (Auto Filename at Convert)" << endl; cout << "Convert-only: <autodef> (auto file name at convert)" << endl;
cout << "Convert-only: <autoext> (auto file extension at convert)" << endl;
cout << "Formats: jpg pgta g5e" << endl; cout << "Formats: jpg pgta g5e" << endl;
} }
return 255; return 255;