sum listeners

This commit is contained in:
dsc 2023-09-03 21:34:25 +03:00
parent cabef9ffe2
commit a0440060b4

View File

@ -16,7 +16,7 @@
<div class="card-body text-center"> <div class="card-body text-center">
<h5 class="title_str card-title pricing-card-title text-muted">|</h5> <h5 class="title_str card-title pricing-card-title text-muted">|</h5>
<ul class="list-unstyled mt-3 mb-4"> <ul class="list-unstyled mt-3 mb-4">
<li class="listeners_str">0 listeners</li> <li class="d-none listeners_str">0 listeners</li>
<li class="progress_str text-muted">00:00 / 00:00</li> <li class="progress_str text-muted">00:00 / 00:00</li>
</ul> </ul>
@ -186,6 +186,7 @@
let blob = JSON.parse(data); let blob = JSON.parse(data);
radio_data = blob; radio_data = blob;
let listeners = 0;
for (let radio_station of radio_station_ids) { for (let radio_station of radio_station_ids) {
if(!blob.hasOwnProperty(radio_station)) continue; if(!blob.hasOwnProperty(radio_station)) continue;
@ -199,10 +200,17 @@
} }
sel_radio_cards[rs.id].find('.title_str').text(song.title); sel_radio_cards[rs.id].find('.title_str').text(song.title);
labelSetListeners(rs.id, rs.listeners); //labelSetListeners(rs.id, rs.listeners);
listeners += rs.listeners;
sel_radio_cards[rs.id].find('.progress_str').text(song.progress_str); sel_radio_cards[rs.id].find('.progress_str').text(song.progress_str);
} }
} }
if(listeners >= 1) {
$('p.lead').text(listeners_str(listeners));
} else {
$('p.lead').text('Enjoy the music :)');
}
} }
// btnMeta: skip, boo, tune // btnMeta: skip, boo, tune