@ -6,11 +6,16 @@ function update(){
@@ -6,11 +6,16 @@ function update(){
varjson_obj=JSON.parse(json_text);
varplaying='';
varfirst=getFirstPlaying(json_obj);
if(first==null){}
elseif(first.artist!=undefined){
playing=first.artist+' - ';
if(first==null){
playing='Mitte munnigi ei mängi prg';
}
elseif(first!=null&&first.artist!=undefined){
playing=first.artist+' - ';
playing+=first.title;
}else{
playing+=first.title;
}
varnowPlaying=playing;
update_field('on-air',playing);
update_listeners(json_obj);
@ -27,8 +32,11 @@ function update_field(field, data){
@@ -27,8 +32,11 @@ function update_field(field, data){
functionupdate_listeners(json_obj){
varnowPlaying=getFirstPlaying(json_obj);
if(nowPlaying!=null){
update_field('listeners1',nowPlaying.listeners);
}
}
functionautoupdate(){
update();
@ -45,11 +53,16 @@ function reset_bg(){
@@ -45,11 +53,16 @@ function reset_bg(){
functiongetFirstPlaying(jsonObj){
varsources=jsonObj.icestats.source;
varmasterStreams=[
'/live',
]
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