Compare commits

..

No commits in common. "9721fbbc8ac04529e97e4fc509896aa9a642ff3e" and "4d0b54f7d6a208673c7979ef51304763544e1781" have entirely different histories.

3 changed files with 25 additions and 31 deletions

View File

@ -53,18 +53,3 @@
(api-output `(("status" . "error")
("message" . ,(format nil "Error loading profile: ~a" e)))
:status 500))))
(define-api asteroid/partial/now-playing-inline () ()
"Get inline text with now playing info (for admin dashboard and widgets)"
(handler-case
(let ((now-playing-stats (icecast-now-playing *stream-base-url*)))
(if now-playing-stats
(progn
(setf (header "Content-Type") "text/plain")
(cdr (assoc :title now-playing-stats)))
(progn
(setf (header "Content-Type") "text/plain")
"Stream Offline")))
(error (e)
(setf (header "Content-Type") "text/plain")
"Error loading stream info")))

View File

@ -185,7 +185,6 @@ async function scanLibrary() {
// Filter tracks based on search
function filterTracks() {
const query = document.getElementById('track-search').value.toLowerCase();
const filtered = tracks.filter(track =>
(track.title || '').toLowerCase().includes(query) ||
(track.artist || '').toLowerCase().includes(query) ||
@ -562,25 +561,35 @@ function displayQueueSearchResults(results) {
// Live stream info update
async function updateLiveStreamInfo() {
try {
const response = await fetch('/api/asteroid/partial/now-playing-inline');
const contentType = response.headers.get("content-type");
if (!contentType.includes('text/plain')) {
console.error('Unexpected content type:', contentType);
const response = await fetch('/api/asteroid/icecast-status');
if (!response.ok) {
return;
}
const nowPlayingText = await response.text();
const nowPlayingEl = document.getElementById('live-now-playing');
const result = await response.json();
if (nowPlayingEl) {
nowPlayingEl.textContent = nowPlayingText;
// Handle Radiance API response format
const data = result.data || result;
// Sources are nested in icestats
const sources = data.icestats?.source;
if (sources) {
const mainStream = Array.isArray(sources)
? sources.find(s => s.listenurl?.includes('/asteroid.aac') || s.listenurl?.includes('/asteroid.mp3'))
: sources;
if (mainStream && mainStream.title) {
const nowPlayingEl = document.getElementById('live-now-playing');
if (nowPlayingEl) {
const parts = mainStream.title.split(' - ');
const artist = parts[0] || 'Unknown';
const track = parts.slice(1).join(' - ') || 'Unknown';
nowPlayingEl.textContent = `${artist} - ${track}`;
}
}
}
} catch (error) {
console.error('Could not fetch stream info:', error);
const nowPlayingEl = document.getElementById('live-now-playing');
if (nowPlayingEl) {
nowPlayingEl.textContent = 'Error loading stream info';
}
}
}

View File

@ -72,8 +72,8 @@
(defun convert-to-docker-path (host-path)
"Convert host file path to Docker container path"
;; Replace the music library path with /app/music/
(let ((library-prefix (namestring *music-library-path*)))
;; Replace /home/glenn/Projects/Code/asteroid/music/library/ with /app/music/
(let ((library-prefix "/home/glenn/Projects/Code/asteroid/music/library/"))
(if (and (stringp host-path)
(>= (length host-path) (length library-prefix))
(string= host-path library-prefix :end1 (length library-prefix)))