From: tomo Date: Wed, 24 Mar 2010 17:01:05 +0000 (+0000) Subject: (exif-image-file-date-time-original): New implementation for X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=97aae194eb5410ff8dd962e0f903ee6a777bf8d6;p=elisp%2Falbum.git (exif-image-file-date-time-original): New implementation for `exiftime'. (iphoto-dir-to-album-dir): Use `ln' instead of GNU's `cp'. --- diff --git a/iphoto-util.el b/iphoto-util.el index 4a53fc8..5b01200 100644 --- a/iphoto-util.el +++ b/iphoto-util.el @@ -17,15 +17,26 @@ ;; (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 +;; "-x" (expand-file-name image-file)) +;; (goto-char (point-min)) +;; (if (re-search-forward +;; "\\([^<>]+\\)" +;; nil t) +;; (match-string 1)))) + +;;; for exiftime Version 1.01 (defun exif-image-file-date-time-original (image-file) (with-temp-buffer - (call-process "exif" nil t nil - "-x" (expand-file-name image-file)) + (call-process "exiftime" nil t nil + (expand-file-name image-file)) (goto-char (point-min)) (if (re-search-forward - "\\([^<>]+\\)" + "^Image Generated: " nil t) - (match-string 1)))) + (buffer-substring (match-end 0)(point-at-eol))))) ;; (directory-files ;; "~/Pictures/iPhoto Library/Originals/2006/") @@ -140,10 +151,14 @@ (unless (file-exists-p album-dir) (make-directory album-dir 'parents)) (dolist (file (directory-files dir 'full nil 'no-sort t)) - (call-process "cp" nil nil nil - "-al" + (call-process "ln" nil nil nil file - album-dir)) + album-dir) + ;; (call-process "gcp" nil nil nil + ;; "-al" + ;; file + ;; album-dir) + ) (with-temp-buffer (insert ";; -*- mode: emacs-lisp; coding: utf-8-jp-er; -*-\n") (insert (pp (list @@ -172,16 +187,22 @@ ((string= (downcase (file-name-extension file)) "jpg") (unless (file-exists-p album-dir-original) (make-directory album-dir-original 'parents)) - (call-process "cp" nil nil nil - "-al" + (call-process "ln" nil nil nil file album-dir-original) + ;; (call-process "gcp" nil nil nil + ;; "-al" + ;; file + ;; album-dir-original) ) (t - (call-process "cp" nil nil nil - "-al" + (call-process "ln" nil nil nil file album-dir) + ;; (call-process "gcp" nil nil nil + ;; "-al" + ;; file + ;; album-dir) )) ) (call-process "chgrp" nil nil nil