]> git.sesse.net Git - kdenlive/commitdiff
Mark THM metadata as ExifTool, not ML
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 11 Feb 2013 08:12:04 +0000 (09:12 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 11 Feb 2013 08:12:04 +0000 (09:12 +0100)
src/projectlist.cpp
src/widgets/clipproperties_ui.ui

index 6564238a1704c3470e7c0443a5f9e1ff62294d10..717d17f78cdad20646f2c6b826a4ce45f070b82e 100644 (file)
@@ -2200,28 +2200,49 @@ void ProjectList::extractMetadata(DocClipBase *clip)
 {
     QMap <QString, QString> props = clip->properties();
     if (KdenliveSettings::use_exiftool() && !props.contains("exiftool")) {
-       QString codecid = props.value("videocodecid").simplified();
-       if (codecid == "h264") {
+       QMap <QString, QString> meta;
+       QString url = clip->fileURL().path();
+       //Check for Canon THM file
+       url = url.section('.', 0, -2) + ".THM";
+       if (QFile::exists(url)) {
+           // Read the exif metadata embeded in the THM file
            QProcess p;
            QStringList args;
-           args << "-g" << "-args" << clip->fileURL().encodedPathAndQuery();
+           args << "-g" << "-args" << url;
            p.start("exiftool", args);
            p.waitForFinished();
            QString res = p.readAllStandardOutput();
            QStringList list = res.split("\n");
-           QMap <QString, QString> meta;
            foreach(QString tagline, list) {
-               if (!tagline.startsWith("-H264")) continue;
-               QString tag = tagline.section(':', 1);
+               if (tagline.startsWith("-File") || tagline.startsWith("-ExifTool")) continue;
+               QString tag = tagline.section(':', 1).simplified();
                if (tag.startsWith("ImageWidth") || tag.startsWith("ImageHeight")) continue;
-               meta.insert(tag.section('=', 0, 0), tag.section('=', 1));
+               if (!tag.section('=', 0, 0).isEmpty() && !tag.section('=', 1).simplified().isEmpty())
+                   meta.insert(tag.section('=', 0, 0), tag.section('=', 1).simplified());
            }
-           clip->setProperty("exiftool", "1");
-           if (!meta.isEmpty()) {
-               clip->setMetadata(meta, "ExifTool");
-               //checkCamcorderFilters(clip, meta);
+       } else {
+           QString codecid = props.value("videocodecid").simplified();
+           if (codecid == "h264") {
+               QProcess p;
+               QStringList args;
+               args << "-g" << "-args" << clip->fileURL().encodedPathAndQuery();
+               p.start("exiftool", args);
+               p.waitForFinished();
+               QString res = p.readAllStandardOutput();
+               QStringList list = res.split("\n");
+               foreach(QString tagline, list) {
+                   if (!tagline.startsWith("-H264")) continue;
+                   QString tag = tagline.section(':', 1);
+                   if (tag.startsWith("ImageWidth") || tag.startsWith("ImageHeight")) continue;
+                   meta.insert(tag.section('=', 0, 0), tag.section('=', 1));
+               }
            }
        }
+       clip->setProperty("exiftool", "1");
+       if (!meta.isEmpty()) {
+           clip->setMetadata(meta, "ExifTool");
+           //checkCamcorderFilters(clip, meta);
+       }
     }
     if (KdenliveSettings::use_magicLantern() && !props.contains("magiclantern")) {
        QMap <QString, QString> meta;
@@ -2238,24 +2259,6 @@ void ProjectList::extractMetadata(DocClipBase *clip)
                }
            }
        }
-       url = url.section('.', 0, -2) + ".THM";
-       if (QFile::exists(url) && KdenliveSettings::use_exiftool()) {
-           // Read the exif metadata embeded in the THM file
-           QProcess p;
-           QStringList args;
-           args << "-g" << "-args" << url;
-           p.start("exiftool", args);
-           p.waitForFinished();
-           QString res = p.readAllStandardOutput();
-           QStringList list = res.split("\n");
-           foreach(QString tagline, list) {
-               if (tagline.startsWith("-File") || tagline.startsWith("-ExifTool")) continue;
-               QString tag = tagline.section(':', 1).simplified();
-               if (tag.startsWith("ImageWidth") || tag.startsWith("ImageHeight")) continue;
-               if (!tag.section('=', 0, 0).isEmpty() && !tag.section('=', 1).simplified().isEmpty())
-                   meta.insert(tag.section('=', 0, 0), tag.section('=', 1).simplified());
-           }
-       }
        
        if (!meta.isEmpty())
            clip->setMetadata(meta, "Magic Lantern");
index 8ae184d23ca39c958dbbb1f40fca5509b56e5f9d..08b71094acc2ae5924455f9d1e32b485279ab0c4 100644 (file)
           <bool>true</bool>
          </property>
          <property name="rootIsDecorated">
-          <bool>false</bool>
+          <bool>true</bool>
          </property>
          <property name="itemsExpandable">
           <bool>true</bool>