(exif-image-file-date-time-original): New implementation for exif
authortomo <tomo>
Thu, 6 Nov 2008 14:03:01 +0000 (14:03 +0000)
committertomo <tomo>
Thu, 6 Nov 2008 14:03:01 +0000 (14:03 +0000)
0.6.15.
(exif-find-image-directories-by-original-date): Modify for iPhoto 8.

iphoto-util.el

index 27d9ed3..4a53fc8 100644 (file)
@@ -6,14 +6,26 @@
 ;;     (if (re-search-forward "^[ \t]*Timestamp: " nil t)
 ;;         (buffer-substring (match-end 0)(point-at-eol)))))
 
+;;; for exif 0.6.9
+;; (defun exif-image-file-date-time-original (image-file)
+;;   (with-temp-buffer
+;;     (call-process "exif" nil t nil
+;;                   "-t" "DateTimeOriginal"
+;;                   (expand-file-name image-file))
+;;     (goto-char (point-min))
+;;     (if (re-search-forward "^[ \t]*Value: " nil t)
+;;         (buffer-substring (match-end 0)(point-at-eol)))))
+
+;;; for exif 0.6.15
 (defun exif-image-file-date-time-original (image-file)
   (with-temp-buffer
     (call-process "exif" nil t nil
-                 "-t" "DateTimeOriginal"
-                 (expand-file-name image-file))
+                 "-x" (expand-file-name image-file))
     (goto-char (point-min))
-    (if (re-search-forward "^[ \t]*Value: " nil t)
-       (buffer-substring (match-end 0)(point-at-eol)))))
+    (if (re-search-forward
+        "<Date_and_Time__original_>\\([^<>]+\\)</Date_and_Time__original_>"
+        nil t)
+       (match-string 1))))
 
 ;; (directory-files
 ;;  "~/Pictures/iPhoto Library/Originals/2006/")
       (when (and (not (string-match "^\\.+$" dir))
                 (setq dir (expand-file-name dir base-dir))
                 (file-directory-p dir)
-                (setq ret (nth 5 (file-attributes dir)))
-                (or (> (car ret)(car date-time))
-                    (and (= (car ret)(car date-time))
-                         (>= (nth 1 ret)(nth 1 date-time))))
+                 ;; (setq ret (nth 5 (file-attributes dir)))
+                 ;; (or (> (car ret)(car date-time))
+                 ;;     (and (= (car ret)(car date-time))
+                 ;;          (>= (nth 1 ret)(nth 1 date-time))))
                 (setq ret
                       (exif-image-file-date-time-original
                        (car