1
0

Template was rewritten to a form that gets pre-compiled into a Go source file. Must help to increase speed drastically.

This commit is contained in:
Alexander Andreev 2022-06-13 18:37:50 +04:00
parent b5d8b58b81
commit 595d7769ec
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -1,3 +1,7 @@
:go:func Index(mainSite string, status *radio.IcecastStatus, songs *[]radio.Song)
:go:import "dwelling-radio/internal/radio"
doctype html
html(lang='en')
head
@ -16,7 +20,7 @@ html(lang='en')
text.logo Arav's dwelling
text.under(y='11') Welcome to my sacred place, wanderer
nav
a(href=.MainSite) Back to main website
a(href=mainSite) Back to main website
h1 Radio
section
small.player-links
@ -31,27 +35,27 @@ html(lang='en')
audio(preload='none' controls='')
source(src='/live/stream.ogg' type='audio/ogg')
| Your browser doesn't support an audio element, it's sad... But you always can take the #[a(href='/playlist') playlist]!
if .Status.ServerStartDate
if status.ServerStartDate != ""
p#radio-status On-air since
time(datetime=.Status.ServerStartISO8601)= .Status.ServerStartDate
time(datetime=status.ServerStartISO8601)= status.ServerStartDate
else
p#radio-status Radio is offline.
p Now playing: #[span#radio-song #{.Status.SongName}]
p Current/peak listeners: #[span#radio-listeners #{.Status.Listeners}] / #[span#radio-listener-peak #{.Status.ListenerPeak}]
p Now playing: #[span#radio-song #{status.SongName}]
p Current/peak listeners: #[span#radio-listeners #{status.Listeners}] / #[span#radio-listener-peak #{status.ListenerPeak}]
p
small Notice: information updates every 45 seconds. But you can #[button(id='btn-update') update] it forcibly.
if .Songs
if len(*songs) > 0
section
h2 Last 10 songs
table#last-played
each s in .Songs
each song in *songs
tr
td= .Time
if ne .Listeners "0"
td= .Listeners
td= song.Time
if song.Listeners != "0"
td= song.Listeners
else
td
td= .Song
td= song.Song
section
p The largest number of simultaneous listeners was #[b 7] at #[time(datetime='2022-02-19') 19 February 2022], and the song was "Röyksopp - 49 Percent".
section