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
parent c0bc316d64
commit 1778a269d8
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)))

View File

@ -47,9 +47,9 @@
<div class="upload-info">
<p><strong>To add your own MP3 files:</strong></p>
<ol>
<li>Copy your MP3/FLAC/OGG/WAV files to: <code>/home/glenn/Projects/Code/asteroid/music/incoming/</code></li>
<li>Click "Copy Files to Library" below</li>
<li>Files will be moved to the library and added to the database</li>
<li>Copy your MP3/FLAC/OGG/WAV files to: <code>/home/glenn/Projects/Code/asteroid/music/incoming/</code></li>
<li>Click "Copy Files to Library" below</li>
<li>Files will be moved to the library and added to the database</li>
</ol>
<p><em>Supported formats: MP3, FLAC, OGG, WAV</em></p>
</div>