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,8 +11,9 @@ async function updateStatus() {
if (!resp.ok || 200 != resp.status) {
$("radio-song").textContent =
$("radio-duration-estimate").textContent =
$("radio-duration").textContent = "";
$("radio-song-listeners").textContent =
$("radio-duration-estimate").textContent =
$("radio-duration").textContent = "";
$("radio-listeners").textContent =
$("radio-listener-peak").textContent = "0";
$("last-songs").lastChild.remove();
@ -36,6 +37,7 @@ async function updateStatus() {
return [-1, null];
$("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-listeners").textContent = s.listeners.current;
$("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>
<div>
if curSong != nil && curSong.Artist != "" {
<p>Now playing: <span id="radio-song">{ curSong.Artist } - { curSong.Title }</span></p>
<p>
Now playing: <span id="radio-song">{ curSong.Artist } - { curSong.Title }</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>
<span id="radio-duration-estimate"></span> <span id="radio-duration">{ curSong.DurationString() }</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>
Time: <span id="radio-duration-estimate"></span><span id="radio-duration">{ curSong.DurationString() }</span>
</p>
} else {
<p>Now playing: <span id="radio-song"></span></p>
<p>
Now playing: <span id="radio-song"></span>
<abbr id="radio-song-listeners" title="Overall and peak numbers of listeners for a currently playing song"></abbr>
<span id="radio-duration-estimate"></span> <span id="radio-duration"></span>
<abbr title="Overall and peak numbers of listeners for a currently playing song">O/P</abbr>: <span id="radio-song-listeners"></span>
Time: <span id="radio-duration-estimate"></span><span id="radio-duration"></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>