From 97aae194eb5410ff8dd962e0f903ee6a777bf8d6 Mon Sep 17 00:00:00 2001 From: tomo Date: Wed, 24 Mar 2010 17:01:05 +0000 Subject: [PATCH] (exif-image-file-date-time-original): New implementation for `exiftime'. (iphoto-dir-to-album-dir): Use `ln' instead of GNU's `cp'. --- iphoto-util.el | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) 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 -- 1.7.10.4