X-Git-Url: http://git.chise.org/gitweb/?p=elisp%2Falbum.git;a=blobdiff_plain;f=iphoto-util.el;h=27d9ed3b993d0f73702ed234165e9d40d7507362;hp=11e84bc047e4a47205bd59a8d4e52ed033c0729d;hb=9d79fc7e91060153698aa35f35c01062c603d2e9;hpb=eb3da6d0353d44d5a65f9893e801e2182580dc85 diff --git a/iphoto-util.el b/iphoto-util.el index 11e84bc..27d9ed3 100644 --- a/iphoto-util.el +++ b/iphoto-util.el @@ -76,15 +76,15 @@ (defun iphoto-dir-format-time-range-as-album-dir (range year month day) (let ((time-min (decode-time (car range))) (time-max (decode-time (cdr range)))) - (format "%s_%s" + (format "%s-%s" (if (and (= (nth 3 time-min) day) (= (nth 4 time-min) month) (= (nth 5 time-min) year)) - (format "%02d-%02d-%02d" + (format "%02dh%02dm%02ds" (nth 2 time-min) (nth 1 time-min) (nth 0 time-min)) - (format "%d-%02d-%02d-%02d-%02d-%02d" + (format "%d-%02d-%02d-%02dh%02dm%02ds" (nth 5 time-min) (nth 4 time-min) (nth 3 time-min) @@ -94,11 +94,11 @@ (if (and (= (nth 3 time-max) day) (= (nth 4 time-max) month) (= (nth 5 time-max) year)) - (format "%02d-%02d-%02d" + (format "%02dh%02dm%02ds" (nth 2 time-max) (nth 1 time-max) (nth 0 time-max)) - (format "%d-%02d-%02d-%02d-%02d-%02d" + (format "%d-%02d-%02d-%02dh%02dm%02ds" (nth 5 time-max) (nth 4 time-max) (nth 3 time-max) @@ -140,27 +140,38 @@ (mapconcat (lambda (time) (mapconcat #'identity - (split-string time "-") + (nbutlast + (split-string time "[hms]")) ":")) - (split-string a-dir-n "_") + (split-string a-dir-n "-") "〜"))) - (cons 'files - (directory-files dir nil nil nil t)) + ;; (cons 'files + ;; (directory-files dir nil nil nil t)) (cons 'exit (concat album-url-prefix album-name))))) (write-region (point-min)(point-max) (expand-file-name "dir.desc" album-dir))) - (unless (file-exists-p album-dir-original) - (make-directory album-dir-original 'parents)) (dolist (file (directory-files (expand-file-name (file-name-nondirectory dir) (format "~/Pictures/iPhoto Library/Originals/%d/" year)) 'full nil 'no-sort t)) - (call-process "cp" nil nil nil - "-al" - file - album-dir-original)) + (cond + ((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" + file + album-dir-original) + ) + (t + (call-process "cp" nil nil nil + "-al" + file + album-dir) + )) + ) (call-process "chgrp" nil nil nil "-R" "www-data" album-dir)