feat: sync-music: ensure valid file name on all files

This commit is contained in:
eriedaberrie 2025-01-29 15:19:07 +00:00
parent 055b9252d3
commit 8bfea36345
2 changed files with 9 additions and 5 deletions

View file

@ -19,7 +19,9 @@ if the file should not be copied."
(funcall make-action-fn
:origin origin
:target (pathname-normalize-unicode
(make-pathname :name (pathname-name origin)
(make-pathname :name (ensure-valid-file-name
(pathname-name
origin))
:type (string-downcase type)
:defaults target)))))
@ -102,10 +104,8 @@ extension equality."
:for output-file-name := (format nil
"~A - ~A"
track-number-str
(ppcre:regex-replace-all
*invalid-char-scanner*
track-title
"!!!"))
(ensure-valid-file-name
track-title))
:for current-action := (make-copy-flac-action
:origin origin-file
:target (pathname-normalize-unicode

View file

@ -36,6 +36,10 @@
:type (maybe-normalize-unicode (pathname-type p))
:defaults p))
(defun ensure-valid-file-name (s)
"Make sure that STRING is a valid file name on Android/NTFS."
(ppcre:regex-replace-all *invalid-char-scanner* s "!!!"))
(defmacro handle-overflow ((unit unit-max) (next-unit &optional next-max) &rest args)
"Handle integer overflow from UNIT with maximum UNIT-MAX into NEXT-UNIT."
(with-gensyms (div rem)