From 511a1b4cd2b37434d5796fe9d2a7f4fc611e5a11 Mon Sep 17 00:00:00 2001 From: eriedaberrie Date: Mon, 23 Dec 2024 01:04:23 -0800 Subject: [PATCH] refactor: sync-music: use alexandria for file I/O --- sync-music/actions.lisp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/sync-music/actions.lisp b/sync-music/actions.lisp index af3e343..81cec53 100644 --- a/sync-music/actions.lisp +++ b/sync-music/actions.lisp @@ -53,19 +53,10 @@ Pushes status message about this action to QUEUE if given.")) (defmethod action-perform ((a copy-meta-action) &optional queue) (declare (ignore queue)) - (let (buf) - (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)) + (let ((buf (read-file-into-byte-vector (copy-action-origin a)))) (setf buf (replace-text-buffer buf ".flac\"" ".opus\"")) (setf buf (replace-text-buffer buf ".wav\"" ".opus\"")) - (with-open-file (output - (action-target a) - :element-type 'octet - :direction :output) - (write-sequence buf output)))) + (write-byte-vector-into-file buf (action-target a)))) (defmethod action-perform ((a delete-action) &optional queue) (declare (ignore queue))