diff --git a/sync-music/sync-music.lisp b/sync-music/sync-music.lisp index 660927b..4ed6b15 100644 --- a/sync-music/sync-music.lisp +++ b/sync-music/sync-music.lisp @@ -20,7 +20,7 @@ if the file should not be copied." :origin origin :target (pathname-normalize-unicode (make-pathname :name (pathname-name origin) - :type type + :type (string-downcase type) :defaults target))))) (defun get-cue-copy-actions (origin origin-files target &optional (test #'string-equal)) @@ -52,6 +52,12 @@ extension equality." :for track-number :from 1 :upto track-count :for track-number-str := (format nil "~2,'0D" track-number) :for track := (libcue:cd-get-track cd track-number) + :for origin-file-name := (let* ((raw-file (libcue:track-get-file-name track)) + (dot (position #\. raw-file :from-end t))) + (subseq raw-file 0 dot)) + :for origin-file := (make-pathname :name origin-file-name + :type "flac" + :defaults origin) :for track-rem := (libcue:track-get-rem track) :for track-cd-text := (libcue:track-get-cd-text track) :for track-date := (or (libcue:ensure-nonempty @@ -67,12 +73,6 @@ extension equality." :for track-genre := (or (libcue:ensure-nonempty (libcue:get-cd-text :genre track-cd-text)) album-genre) - :for origin-file-name := (let* ((raw-file (libcue:track-get-file-name track)) - (dot (position #\. raw-file :from-end t))) - (subseq raw-file 0 dot)) - :for origin-file := (make-pathname :name origin-file-name - :type "flac" - :defaults origin) :for metadata := (let ((metadata)) (flet ((add-metadata (field value) (when value @@ -105,6 +105,8 @@ extension equality." :length (libcue:ensure-nonempty (libcue:track-get-length track)) :metadata metadata) + :unless (uiop:file-exists-p origin-file) + :return nil :do (fset:adjoinf actions current-action) :finally (return actions)))))))