From 136fa2fa7424ca06e5486e6d00fb0d0118f41067 Mon Sep 17 00:00:00 2001 From: Luis Pereira Date: Tue, 14 Oct 2025 11:28:23 +0100 Subject: [PATCH] fix: avoid icecast xml to be shown on frontend when there is no artist --- asteroid.lisp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/asteroid.lisp b/asteroid.lisp index 936430c..1f45c77 100644 --- a/asteroid.lisp +++ b/asteroid.lisp @@ -857,8 +857,10 @@ (let* ((source-section (subseq xml-string match-start (or (cl-ppcre:scan "" xml-string :start match-start) (length xml-string)))) - (title (or (cl-ppcre:regex-replace-all ".*(.*?).*" source-section "\\1") "Unknown")) - (listeners (or (cl-ppcre:regex-replace-all ".*(.*?).*" source-section "\\1") "0"))) + (titlep (cl-ppcre:all-matches "" source-section)) + (listenersp (cl-ppcre:all-matches "<listeners>" source-section)) + (title (if titlep (cl-ppcre:regex-replace-all ".*<title>(.*?).*" source-section "\\1") "Unknown")) + (listeners (if listenersp (cl-ppcre:regex-replace-all ".*(.*?).*" source-section "\\1") "0"))) ;; Return JSON in format expected by frontend (api-output `(("icestats" . (("source" . (("listenurl" . ,(concatenate 'string *stream-base-url* "/asteroid.mp3"))