]> git.datanom.net - lensdb.git/blobdiff - lib/main.cpp
Implement Exif scanner
[lensdb.git] / lib / main.cpp
index ad1d7048115b92e36978ce819ecf16788cc01926..27efeaab0ea2c49417c7233bd68511745eadb77c 100644 (file)
@@ -1,3 +1,39 @@
- int main(int argc, char** argv) {
-        return 0;
- }
+#include "main.hpp"
+
+using namespace std;
+
+
+ExifScanner::ExifScanner(const char* file): file(file) {
+
+}
+
+ExifScanner::~ExifScanner() {
+
+}
+
+void ExifScanner::scanner_do_work() {
+       if (file == NULL){
+        cout << "Example1: Read metadata from an image." << endl;
+        cout << "Please specify input file name" << endl;
+        return;
+    }
+
+    // create our ExifTool object
+    ExifTool *et = new ExifTool();
+    // read metadata from the image
+    TagInfo *info = et->ImageInfo(file);
+    if (info) {
+        // print returned information
+        for (TagInfo *i=info; i; i=i->next) {
+            cout << i->name << " = " << i->value << endl;
+        }
+        // we are responsible for deleting the information when done
+        delete info;
+    } else if (et->LastComplete() <= 0) {
+        cerr << "Error executing exiftool!" << endl;
+    }
+    // print exiftool stderr messages
+    char *err = et->GetError();
+    if (err) cout << err;
+    delete et;      // delete our ExifTool object              
+}
This page took 0.284181 seconds and 5 git commands to generate.