feat: sync-music: don't use cue track files if that file doesn't exist

This commit is contained in:
eriedaberrie 2024-11-12 01:21:16 -08:00
parent cea9a46872
commit 3eb4ae3b82

View file

@ -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 (some (lambda (p) (equal p origin-file)) origin-files)
:return nil
:do (fset:adjoinf actions current-action)
:finally (return actions)))))))