1
0

Changed layout for a song info.

This commit is contained in:
Alexander Andreev 2024-05-11 05:35:14 +04:00
parent 5d042cdb3a
commit a374dfd510
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34
2 changed files with 10 additions and 8 deletions

View File

@ -11,6 +11,7 @@ async function updateStatus() {
if (!resp.ok || 200 != resp.status) { if (!resp.ok || 200 != resp.status) {
$("radio-song").textContent = $("radio-song").textContent =
$("radio-song-listeners").textContent =
$("radio-duration-estimate").textContent = $("radio-duration-estimate").textContent =
$("radio-duration").textContent = ""; $("radio-duration").textContent = "";
$("radio-listeners").textContent = $("radio-listeners").textContent =
@ -36,6 +37,7 @@ async function updateStatus() {
return [-1, null]; return [-1, null];
$("radio-song").textContent = `${s.current_song.artist} - ${s.current_song.title}`; $("radio-song").textContent = `${s.current_song.artist} - ${s.current_song.title}`;
$("radio-song-listeners").textContent = `${s.listeners.overall} / ${s.listeners.current_peak}`;
$("radio-duration").textContent = formatDuration(new Date(s.current_song.duration_msec)); $("radio-duration").textContent = formatDuration(new Date(s.current_song.duration_msec));
$("radio-listeners").textContent = s.listeners.current; $("radio-listeners").textContent = s.listeners.current;
$("radio-listener-peak").textContent = s.listeners.peak; $("radio-listener-peak").textContent = s.listeners.peak;

View File

@ -67,16 +67,16 @@ templ Index(curSong *radio.Song, sl []radio.Song, slLen int64, lstnrs *radio.Lis
</audio> </audio>
<div> <div>
if curSong != nil && curSong.Artist != "" { if curSong != nil && curSong.Artist != "" {
<p>Now playing: <span id="radio-song">{ curSong.Artist } - { curSong.Title }</span></p>
<p> <p>
Now playing: <span id="radio-song">{ curSong.Artist } - { curSong.Title }</span> <abbr title="Overall and peak numbers of listeners for a currently playing song">O/P</abbr>: <span id="radio-song-listeners">{ strconv.FormatInt(lstnrs.Overall(), 10) } / { strconv.FormatInt(lstnrs.CurrentPeak(), 10) }</span>
<abbr id="radio-song-listeners" title="Overall and peak numbers of listeners for a currently playing song">{ strconv.FormatInt(lstnrs.Overall(), 10) }/{ strconv.FormatInt(lstnrs.CurrentPeak(), 10) }</abbr> Time: <span id="radio-duration-estimate"></span><span id="radio-duration">{ curSong.DurationString() }</span>
<span id="radio-duration-estimate"></span> <span id="radio-duration">{ curSong.DurationString() }</span>
</p> </p>
} else { } else {
<p>Now playing: <span id="radio-song"></span></p>
<p> <p>
Now playing: <span id="radio-song"></span> <abbr title="Overall and peak numbers of listeners for a currently playing song">O/P</abbr>: <span id="radio-song-listeners"></span>
<abbr id="radio-song-listeners" title="Overall and peak numbers of listeners for a currently playing song"></abbr> Time: <span id="radio-duration-estimate"></span><span id="radio-duration"></span>
<span id="radio-duration-estimate"></span> <span id="radio-duration"></span>
</p> </p>
} }
<p>Current/peak listeners: <span id="radio-listeners">{ strconv.FormatInt(lstnrs.Current(), 10) }</span> / <span id="radio-listener-peak">{ strconv.FormatInt(lstnrs.Peak(), 10) }</span></p> <p>Current/peak listeners: <span id="radio-listeners">{ strconv.FormatInt(lstnrs.Current(), 10) }</span> / <span id="radio-listener-peak">{ strconv.FormatInt(lstnrs.Peak(), 10) }</span></p>