OK, I'm running a little Internet Radio stream for my own enjoyment, and I made up a little web player for it that displays some metadata.
Anyway, the problem is that when there's only one stream running on my server, everything's under 'source' and the metadata routine works fine, but when the header is something like '0' – as is the case when there's more than one active stream on the server – it breaks because what it's looking for is no longer under 'source.'
For example, when the JSON is like this:
My webplayer's metadata grabbing routine works fine, but if it's like this:
It doesn't work.
Here's the code for the metadata routine:
Any ideas? While I could use AI to try fixing it, I'd rather not (I'm old-fashioned... I like communicating with real humans), but if any of you want to plug it in to your model of choice and give it a try, feel free.
c
Anyway, the problem is that when there's only one stream running on my server, everything's under 'source' and the metadata routine works fine, but when the header is something like '0' – as is the case when there's more than one active stream on the server – it breaks because what it's looking for is no longer under 'source.'
For example, when the JSON is like this:
JSON:
icestats
admin "***"
host "***"
location "Nowhere"
server_id "Icecast 2.4.4"
server_start "Sat, 22 Aug 2026 13:23:01 -0700"
server_start_iso8601 "2026-08-22T13:23:01-0700"
source
audio_info "ice-bitrate=320;ice-channels=2;ice-samplerate=44100"
bitrate 320
genre "various"
ice-bitrate 320
ice-channels 2
ice-samplerate 44100
listener_peak 1
listeners 0
listenurl "***"
server_description "Unspecified description"
server_name "Unspecified name"
server_type "audio/mpeg"
stream_start "Sat, 22 Aug 2026 13:42:09 -0700"
stream_start_iso8601 "2026-08-22T13:42:09-0700"
title "Nicolette Larson - Rio de Janeiro Blue - In The Nick Of Time"
dummy null
JSON:
icestats
admin "***"
host "***"
location "Nowhere"
server_id "Icecast 2.4.4"
server_start "Sat, 22 Aug 2026 13:23:01 -0700"
server_start_iso8601 "2026-08-22T13:23:01-0700"
source
0
audio_info "ice-bitrate=320;ice-channels=2;ice-samplerate=44100"
bitrate 320
genre "various"
ice-bitrate 320
ice-channels 2
ice-samplerate 44100
listener_peak 1
listeners 0
listenurl "***"
server_description "Unspecified description"
server_name "Unspecified name"
server_type "audio/mpeg"
stream_start "Sat, 22 Aug 2026 13:42:09 -0700"
stream_start_iso8601 "2026-08-22T13:42:09-0700"
title "James Taylor - Country Road - Sweet Baby James"
dummy null
1
audio_info "ice-bitrate=256;ice-channels=2;ice-samplerate=44100"
bitrate 256
genre "Various"
ice-bitrate 256
ice-channels 2
ice-samplerate 44100
listener_peak 0
listeners 0
listenurl "***"
server_description "Unspecified description"
server_name "Radio1610"
server_type "audio/aac"
stream_start "Sat, 22 Aug 2026 13:59:16 -0700"
stream_start_iso8601 "2026-08-22T13:59:16-0700"
title "James Taylor - Country Road - Sweet Baby James"
dummy null
Here's the code for the metadata routine:
JavaScript:
function fetchCurrentlyPlaying ()
{jQuery.get('***/status-json.xsl', {}, function (response)
{$('.currently-playing-title').html(response.icestats.source['title']);
document.title = response.icestats.source['title'];});}
Any ideas? While I could use AI to try fixing it, I'd rather not (I'm old-fashioned... I like communicating with real humans), but if any of you want to plug it in to your model of choice and give it a try, feel free.
c
Last edited: