refactor: sync-music: use alexandria for file I/O

This commit is contained in:
eriedaberrie 2024-12-23 01:04:23 -08:00
parent fb8d4127e4
commit 511a1b4cd2

View file

@ -53,19 +53,10 @@ Pushes status message about this action to QUEUE if given."))
(defmethod action-perform ((a copy-meta-action) &optional queue) (defmethod action-perform ((a copy-meta-action) &optional queue)
(declare (ignore queue)) (declare (ignore queue))
(let (buf) (let ((buf (read-file-into-byte-vector (copy-action-origin a))))
(with-open-file (input
(copy-action-origin a)
:element-type 'octet)
(setf buf (make-array (file-length input) :element-type 'octet))
(read-sequence buf input))
(setf buf (replace-text-buffer buf ".flac\"" ".opus\"")) (setf buf (replace-text-buffer buf ".flac\"" ".opus\""))
(setf buf (replace-text-buffer buf ".wav\"" ".opus\"")) (setf buf (replace-text-buffer buf ".wav\"" ".opus\""))
(with-open-file (output (write-byte-vector-into-file buf (action-target a))))
(action-target a)
:element-type 'octet
:direction :output)
(write-sequence buf output))))
(defmethod action-perform ((a delete-action) &optional queue) (defmethod action-perform ((a delete-action) &optional queue)
(declare (ignore queue)) (declare (ignore queue))