@ -26,8 +31,11 @@ function update_field(field, data){
}
}
functionupdate_listeners(json_obj){
functionupdate_listeners(json_obj){
varnowPlaying=getFirstPlaying(json_obj);
varnowPlaying=getFirstPlaying(json_obj);
update_field('listeners1',nowPlaying.listeners);
if(nowPlaying!=null){
update_field('listeners1',nowPlaying.listeners);
}
}
}
functionautoupdate(){
functionautoupdate(){
@ -45,11 +53,16 @@ function reset_bg(){
functiongetFirstPlaying(jsonObj){
functiongetFirstPlaying(jsonObj){
varsources=jsonObj.icestats.source;
varsources=jsonObj.icestats.source;
varmasterStreams=[
'/live',
]
for(o=0;o<sources.length;o++){
for(o=0;o<sources.length;o++){
if(sources[o].title!=undefined){
if(sources[o].title!=undefined&&masterStreams.some(stream=>sources[o].listenurl.endsWith(stream))){//check if source has a title key AND belongs to masterStreams