Added song start time column. Added listener for update button.
This commit is contained in:
parent
baf818db02
commit
f7322a78b4
@ -21,7 +21,7 @@ function updateLastPlayedSong() {
|
||||
fetch('/lastsong')
|
||||
.then(r => r.json())
|
||||
.then(last_played => {
|
||||
let cur_artist = $('last-played').firstChild.lastChild.firstChild.innerText;
|
||||
let cur_artist = $('last-played').firstChild.lastChild.children[1].innerText;
|
||||
let cur_title = $('last-played').firstChild.lastChild.lastChild.innerText;
|
||||
|
||||
if (last_played.artist == cur_artist && last_played.title == cur_title)
|
||||
@ -30,6 +30,8 @@ function updateLastPlayedSong() {
|
||||
$('last-played').firstChild.firstChild.remove();
|
||||
|
||||
let row = $('last-played').insertRow();
|
||||
let start_time = row.insertCell();
|
||||
start_time.appendChild(document.createTextNode(last_played.start_time_local));
|
||||
let artist_cell = row.insertCell();
|
||||
artist_cell.appendChild(document.createTextNode(last_played.artist));
|
||||
let title_cell = row.insertCell();
|
||||
@ -37,5 +39,10 @@ function updateLastPlayedSong() {
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById("btn-update").addEventListener("click", () => {
|
||||
updateLastPlayedSong();
|
||||
updateRadioStatus();
|
||||
})
|
||||
|
||||
setInterval(updateRadioStatus, 45000);
|
||||
setInterval(updateLastPlayedSong, 45000);
|
Loading…
Reference in New Issue
Block a user