]> git.datanom.net - lensdb.git/blob - lib/main.cpp
Implement Exif scanner
[lensdb.git] / lib / main.cpp
1 #include "main.hpp"
2
3 using namespace std;
4
5
6 ExifScanner::ExifScanner(const char* file): file(file) {
7
8 }
9
10 ExifScanner::~ExifScanner() {
11
12 }
13
14 void ExifScanner::scanner_do_work() {
15 if (file == NULL){
16 cout << "Example1: Read metadata from an image." << endl;
17 cout << "Please specify input file name" << endl;
18 return;
19 }
20
21 // create our ExifTool object
22 ExifTool *et = new ExifTool();
23 // read metadata from the image
24 TagInfo *info = et->ImageInfo(file);
25 if (info) {
26 // print returned information
27 for (TagInfo *i=info; i; i=i->next) {
28 cout << i->name << " = " << i->value << endl;
29 }
30 // we are responsible for deleting the information when done
31 delete info;
32 } else if (et->LastComplete() <= 0) {
33 cerr << "Error executing exiftool!" << endl;
34 }
35 // print exiftool stderr messages
36 char *err = et->GetError();
37 if (err) cout << err;
38 delete et; // delete our ExifTool object
39 }
This page took 0.264934 seconds and 6 git commands to generate.