From: tomo Date: Thu, 6 Nov 2008 14:03:01 +0000 (+0000) Subject: (exif-image-file-date-time-original): New implementation for exif X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=57a47969405605770ae8bf1587347a439b6eed64;p=elisp%2Falbum.git (exif-image-file-date-time-original): New implementation for exif 0.6.15. (exif-find-image-directories-by-original-date): Modify for iPhoto 8. --- diff --git a/iphoto-util.el b/iphoto-util.el index 27d9ed3..4a53fc8 100644 --- a/iphoto-util.el +++ b/iphoto-util.el @@ -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 + "\\([^<>]+\\)" + nil t) + (match-string 1)))) ;; (directory-files ;; "~/Pictures/iPhoto Library/Originals/2006/") @@ -27,10 +39,10 @@ (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