diff --git a/.gitignore b/.gitignore index 5eca3fa..e869ad8 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ buildapp quicklisp-manifest.txt notes/ run-asteroid.sh +build-sbcl.sh diff --git a/asteroid.lisp b/asteroid.lisp index 24685e1..7a32ad1 100644 --- a/asteroid.lisp +++ b/asteroid.lisp @@ -9,19 +9,25 @@ ;; Define as RADIANCE module (define-module asteroid - (:use #:cl #:radiance #:lass) + (:use #:cl #:radiance #:lass #:r-clip) (:domain "asteroid")) ;; Configuration (defparameter *server-port* 8080) -;; Read and compile LASS from file +;; Define CLIP attribute processor for data-text +(clip:define-attribute-processor data-text (node value) + (plump:clear node) + (plump:make-text-node node (clip:clipboard value))) + +;; LASS CSS generation (defun generate-css () - "Generate CSS by reading LASS from static/asteroid.lass file" - (let ((lass-file (merge-pathnames "static/asteroid.lass"))) - (lass:compile-and-write - (with-open-file (in lass-file) - (read in))))) + "Generate CSS from LASS file" + (lass:compile-and-write + (read-from-string + (alexandria:read-file-into-string + (merge-pathnames "static/asteroid.lass" + (asdf:system-source-directory :asteroid)))))) ;; Generate CSS file using LASS (defun compile-styles () @@ -40,93 +46,45 @@ ;; RADIANCE route handlers (define-page index #@"/" () - (spinneret:with-html-string - (:doctype) - (:html - (:head - (:title "đŸŽĩ ASTEROID RADIO đŸŽĩ") - (:meta :charset "utf-8") - (:meta :name "viewport" :content "width=device-width, initial-scale=1") - (:link :rel "stylesheet" :type "text/css" :href "/static/asteroid.css")) - (:body - (:div.container - (:h1 "đŸŽĩ ASTEROID RADIO đŸŽĩ") - (:div.status - (:h2 "Station Status") - (:p "đŸŸĸ LIVE - Broadcasting asteroid music for hackers") - (:p "Current listeners: 0") - (:p "Stream quality: 128kbps MP3")) - (:div.nav - (:a :href "/admin" "Admin Dashboard") - (:a :href "/player" "Web Player") - (:a :href "/api/status" "API Status")) - (:div - (:h2 "Now Playing") - (:p "Artist: The Void") - (:p "Track: Silence") - (:p "Album: Startup Sounds") - (:p "Duration: ∞"))))))) + (let ((template-path (merge-pathnames "template/front-page.chtml" + (asdf:system-source-directory :asteroid)))) + (clip:process-to-string + (plump:parse (alexandria:read-file-into-string template-path)) + :title "đŸŽĩ ASTEROID RADIO đŸŽĩ" + :station-name "đŸŽĩ ASTEROID RADIO đŸŽĩ" + :status-message "đŸŸĸ LIVE - Broadcasting asteroid music for hackers" + :listeners "0" + :stream-quality "128kbps MP3" + :now-playing-artist "The Void" + :now-playing-track "Silence" + :now-playing-album "Startup Sounds" + :now-playing-duration "∞"))) (define-page admin #@"/admin" () - (spinneret:with-html-string - (:doctype) - (:html - (:head - (:title "Asteroid Radio - Admin Dashboard") - (:meta :charset "utf-8") - (:link :rel "stylesheet" :type "text/css" :href "/static/asteroid.css")) - (:body - (:div.container - (:a.back :href "/" "← Back to Main") - (:h1 "Admin Dashboard") - (:div.panel - (:h2 "Playback Control") - (:button "Play") - (:button "Pause") - (:button "Skip") - (:button "Stop")) - (:div.panel - (:h2 "Library Management") - (:button "Upload Music") - (:button "Manage Playlists") - (:button "Scan Library")) - (:div.panel - (:h2 "Live DJ") - (:button "Go Live") - (:button "End Session") - (:button "Mic Check")) - (:div.panel - (:h2 "System Status") - (:p "Server: Running") - (:p "Database: Not Connected") - (:p "Liquidsoap: Not Running") - (:p "Icecast: Not Running"))))))) + (let ((template-path (merge-pathnames "template/admin.chtml" + (asdf:system-source-directory :asteroid)))) + (clip:process-to-string + (plump:parse (alexandria:read-file-into-string template-path)) + :title "Asteroid Radio - Admin Dashboard" + :server-status "đŸŸĸ Running" + :database-status "🟡 Not Connected" + :liquidsoap-status "🔴 Not Running" + :icecast-status "🔴 Not Running"))) (define-page player #@"/player" () - (spinneret:with-html-string - (:doctype) - (:html - (:head - (:title "Asteroid Radio - Web Player") - (:meta :charset "utf-8") - (:link :rel "stylesheet" :type "text/css" :href "/static/asteroid.css")) - (:body - (:a.back :href "/" "← Back to Main") - (:div.player - (:h1 "đŸŽĩ ASTEROID RADIO PLAYER đŸŽĩ") - (:div.now-playing - (:div "Now Playing:") - (:div "Silence - The Sound of Startup")) - (:div.controls - (:button "â–ļ Play Stream") - (:button "⏸ Pause") - (:button "🔊 Volume")) - (:div - (:p "Stream URL: http://localhost:8000/asteroid") - (:p "Bitrate: 128kbps MP3") - (:p "Status: Offline"))))))) + (let ((template-path (merge-pathnames "template/player.chtml" + (asdf:system-source-directory :asteroid)))) + (clip:process-to-string + (plump:parse (alexandria:read-file-into-string template-path)) + :title "Asteroid Radio - Web Player" + :stream-url "http://localhost:8000/asteroid" + :bitrate "128kbps MP3" + :now-playing-artist "The Void" + :now-playing-track "Silence" + :now-playing-album "Startup Sounds" + :player-status "Stopped"))) -(define-page api/status #@"/api/status" () +(define-page status-api #@"/status" () (setf (radiance:header "Content-Type") "application/json") (cl-json:encode-json-to-string `(("status" . "running") diff --git a/template/admin.chtml b/template/admin.chtml new file mode 100644 index 0000000..afb3d19 --- /dev/null +++ b/template/admin.chtml @@ -0,0 +1,36 @@ + + + + Asteroid Radio - Admin Dashboard + + + + + +
+

đŸŽ›ī¸ ADMIN DASHBOARD

+ +
+
+

Server Status

+

đŸŸĸ Running

+
+
+

Database Status

+

🟡 Not Connected

+
+
+

Liquidsoap Status

+

🔴 Not Running

+
+
+

Icecast Status

+

🔴 Not Running

+
+
+
+ + diff --git a/template/front-page.chtml b/template/front-page.chtml index 421e221..14ffa8c 100644 --- a/template/front-page.chtml +++ b/template/front-page.chtml @@ -1,48 +1,32 @@ - - - đŸŽĩ ASTEROID RADIO đŸŽĩ - - - - - -
-

đŸŽĩ ASTEROID RADIO đŸŽĩ

-
-

Station Status

-

đŸŸĸ LIVE - Broadcasting asteroid music for hackers -

Current listeners: 0 -

Stream quality: 128kbps MP3 -

- -
-

Now Playing

-

Artist: The Void -

Track: Silence -

Album: Startup Sounds -

Duration: ∞ -

+ + + đŸŽĩ ASTEROID RADIO đŸŽĩ + + + + + +
+

đŸŽĩ ASTEROID RADIO đŸŽĩ

+
+

Station Status

+

đŸŸĸ LIVE - Broadcasting asteroid music for hackers

+

Current listeners: 0

+

Stream quality: 128kbps MP3

+
+ +
+

Now Playing

+

Artist: The Void

+

Track: Silence

+

Album: Startup Sounds

+

Duration: ∞

+
- + diff --git a/template/player.chtml b/template/player.chtml new file mode 100644 index 0000000..ebbea80 --- /dev/null +++ b/template/player.chtml @@ -0,0 +1,33 @@ + + + + Asteroid Radio - Web Player + + + + + +
+

đŸŽĩ WEB PLAYER

+ +
+
+

Now Playing

+

Artist: The Void

+

Track: Silence

+

Album: Startup Sounds

+
+
+ + +

Stream: http://localhost:8000/asteroid

+

Quality: 128kbps MP3

+

Status: Stopped

+
+
+
+ +