Implement RADIANCE database integration
- Add database collections for tracks and playlists - Configure proper RADIANCE field types (:text, :integer) - Add r-data-model dependency for database backend - Fix build-executable.lisp RADIANCE environment handling - Update admin dashboard to show real database connection status - Database now initializes successfully on server startup
This commit is contained in:
parent
1994e3b515
commit
1076582fb4
|
|
@ -14,7 +14,8 @@
|
||||||
:spinneret
|
:spinneret
|
||||||
:cl-json
|
:cl-json
|
||||||
:dexador
|
:dexador
|
||||||
:lass)
|
:lass
|
||||||
|
:r-data-model)
|
||||||
:pathname "./"
|
:pathname "./"
|
||||||
:components ((:file "app-utils")
|
:components ((:file "app-utils")
|
||||||
(:file "module")
|
(:file "module")
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,32 @@
|
||||||
|
|
||||||
;; Configuration
|
;; Configuration
|
||||||
(defparameter *server-port* 8080)
|
(defparameter *server-port* 8080)
|
||||||
|
(defparameter *music-library-path*
|
||||||
|
(merge-pathnames "music/library/"
|
||||||
|
(asdf:system-source-directory :asteroid)))
|
||||||
|
(defparameter *supported-formats* '("mp3" "flac" "ogg" "wav"))
|
||||||
|
|
||||||
|
;; Database initialization - must be in db:connected trigger
|
||||||
|
(define-trigger db:connected ()
|
||||||
|
"Initialize database collections when database connects"
|
||||||
|
(unless (db:collection-exists-p "tracks")
|
||||||
|
(db:create "tracks" '((title :text)
|
||||||
|
(artist :text)
|
||||||
|
(album :text)
|
||||||
|
(duration :integer)
|
||||||
|
(file-path :text)
|
||||||
|
(format :text)
|
||||||
|
(bitrate :integer)
|
||||||
|
(added-date :integer)
|
||||||
|
(play-count :integer))))
|
||||||
|
|
||||||
|
(unless (db:collection-exists-p "playlists")
|
||||||
|
(db:create "playlists" '((name :text)
|
||||||
|
(description :text)
|
||||||
|
(created-date :integer)
|
||||||
|
(track-ids :text))))
|
||||||
|
|
||||||
|
(format t "Database collections initialized~%"))
|
||||||
|
|
||||||
;; Define CLIP attribute processor for data-text
|
;; Define CLIP attribute processor for data-text
|
||||||
(clip:define-attribute-processor data-text (node value)
|
(clip:define-attribute-processor data-text (node value)
|
||||||
|
|
@ -67,7 +93,9 @@
|
||||||
(plump:parse (alexandria:read-file-into-string template-path))
|
(plump:parse (alexandria:read-file-into-string template-path))
|
||||||
:title "Asteroid Radio - Admin Dashboard"
|
:title "Asteroid Radio - Admin Dashboard"
|
||||||
:server-status "🟢 Running"
|
:server-status "🟢 Running"
|
||||||
:database-status "🟡 Not Connected"
|
:database-status (handler-case
|
||||||
|
(if (db:connected-p) "🟢 Connected" "🔴 Disconnected")
|
||||||
|
(error () "🔴 No Database Backend"))
|
||||||
:liquidsoap-status "🔴 Not Running"
|
:liquidsoap-status "🔴 Not Running"
|
||||||
:icecast-status "🔴 Not Running")))
|
:icecast-status "🔴 Not Running")))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,15 @@
|
||||||
;; Build script for creating asteroid executable using save-lisp-and-die
|
;; Build script for creating asteroid executable using save-lisp-and-die
|
||||||
;; ASDF will automatically find the project via source-registry.conf
|
;; ASDF will automatically find the project via source-registry.conf
|
||||||
|
|
||||||
;; Load the system
|
;; Load RADIANCE first, then handle environment
|
||||||
(ql:quickload :asteroid)
|
(ql:quickload :radiance)
|
||||||
|
|
||||||
|
;; Load the system with RADIANCE environment handling
|
||||||
|
(handler-bind ((radiance-core:environment-not-set
|
||||||
|
(lambda (c)
|
||||||
|
(declare (ignore c))
|
||||||
|
(invoke-restart 'continue))))
|
||||||
|
(ql:quickload :asteroid))
|
||||||
|
|
||||||
;; Define the main function for the executable
|
;; Define the main function for the executable
|
||||||
(defun main ()
|
(defun main ()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue