recursively scan the music directory to implicit depth 2

it is likely that the music library will contain directories of
albums, read the files inside those dirs.
This commit is contained in:
Brian O'Reilly 2025-09-14 15:43:33 -04:00 committed by Brian O'Reilly
parent 71a55ee143
commit 16f3592e97
3 changed files with 11 additions and 4 deletions

View File

@ -285,7 +285,9 @@
("listeners" . 0)
("stream-url" . "http://localhost:8000/asteroid"))))
;; RADIANCE server management functions
(defun start-server (&key (port *server-port*))
"Start the Asteroid Radio RADIANCE server"
(format t "Starting Asteroid Radio RADIANCE server on port ~a~%" port)

View File

@ -12,6 +12,11 @@
(remove-if-not #'supported-audio-file-p
(cl-fad:list-directory directory :follow-symlinks nil))))
(defun scan-directory-for-music-recursively (path)
(loop for directory in (uiop:subdirectories path)
with music = (scan-directory-for-music path)
appending (scan-directory-for-music directory)))
(defun extract-metadata-with-taglib (file-path)
"Extract metadata using taglib library"
(handler-case
@ -68,7 +73,7 @@
(defun scan-music-library (&optional (directory *music-library-path*))
"Scan music library directory and add tracks to database"
(format t "Scanning music library: ~a~%" directory)
(let ((audio-files (scan-directory-for-music directory))
(let ((audio-files (scan-directory-for-music-recursively directory))
(added-count 0))
(dolist (file audio-files)
(let ((metadata (extract-metadata-with-taglib file)))