summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2017-02-23 00:52:18 +0530
committerArun Isaac2017-02-23 00:52:18 +0530
commitb99c161c985726f76c9f93b45c14db10d2198b43 (patch)
treef8e11f897a30916f6e2767a51624ce7f471f8b70
parentc18b8a0fd8953853864b69d4884bfc6da3ed0215 (diff)
downloadexiftool.el-b99c161c985726f76c9f93b45c14db10d2198b43.tar.gz
exiftool.el-b99c161c985726f76c9f93b45c14db10d2198b43.tar.lz
exiftool.el-b99c161c985726f76c9f93b45c14db10d2198b43.zip
Return empty string for missing tags.
* el-exiftool.el (el-exiftool-read): Handle case when tag is not
  found. Force exiftool to print missing tags, and replace their
  values with an empty string.
-rw-r--r--el-exiftool.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/el-exiftool.el b/el-exiftool.el
index dd4081b..c68664b 100644
--- a/el-exiftool.el
+++ b/el-exiftool.el
@@ -70,10 +70,13 @@ to the exiftool command line application."
 \(fn FILE TAG...)"
   (mapcar
    (lambda (line)
-     (apply 'cons (split-string line ": ")))
+     (cl-destructuring-bind
+	 (tag value) (split-string line ": ")
+       (let ((value (if (equal value "-") "" value)))
+	 (cons tag value))))
    (split-string
     (apply 'el-exiftool-command
-	   "-s" "-s"
+	   "-s" "-s" "-f"
 	   (append
 	    (mapcar (apply-partially 'format "-%s") tags)
 	    (list file)))