Compare commits

..

No commits in common. "d9cf6f02df04fbd0c620b90aeae290d37dfd8d8c" and "306a2c1cc806d8d966b21a99587187ffcb233fd1" have entirely different histories.

1 changed files with 5 additions and 19 deletions

View File

@ -1,9 +1,6 @@
#include <rapidjson/document.h> #include <rapidjson/document.h>
#include <rapidjson/filereadstream.h> #include <rapidjson/filereadstream.h>
#include <unistd.h>
#include <cstdlib>
#include <algorithm> #include <algorithm>
#include <cstdio> #include <cstdio>
#include <fstream> #include <fstream>
@ -17,28 +14,17 @@ std::string yearstr(int year) {
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int c;
bool download_mode =false; bool download_mode =false;
int numfiles = 0; if (argc == 2) {
while ((c = getopt (argc, argv, "d:n:")) != -1) std::string arg1 = argv[1];
switch(c) download_mode = arg1=="--download";
{ }
case 'd': // download mode
download_mode = true;
break;
case 'n': // number of files to process
numfiles = atoi(optarg);
break;
default:
break;
}
char filename[64]; char filename[64];
snprintf(filename, sizeof filename, "out.csv"); snprintf(filename, sizeof filename, "out.csv");
std::ofstream out_file1; std::ofstream out_file1;
out_file1.open(filename); out_file1.open(filename);
out_file1<<"id, Caption/title, production start year, end year, Description, Item url, Image Source, image_filename, subjects, date published, collection name, museum name, exif_model, exif_iso, exif_focallength, exif_exposuretime, exif_aperture, exif_datetimeoriginal, liceses\n"; out_file1<<"id, Caption/title, production start year, end year, Description, Item url, Image Source, image_filename, subjects, date published, collection name, museum name, exif_model, exif_iso, exif_focallength, exif_exposuretime, exif_aperture, exif_datetimeoriginal, liceses\n";
for (auto i = 0; i<numfiles; i++) { for (auto i = 0; i<4; i++) {
char in_file_i[64]; char in_file_i[64];
snprintf(in_file_i, sizeof in_file_i, "data_%d.json", i); snprintf(in_file_i, sizeof in_file_i, "data_%d.json", i);
// Open the file // Open the file