2024-05-10 00:11:33 +04:00
|
|
|
package web
|
|
|
|
|
|
|
|
import "dwelling-radio/internal/radio"
|
|
|
|
import "strconv"
|
|
|
|
import "dwelling-radio/pkg/utils"
|
|
|
|
import "net/http"
|
|
|
|
|
|
|
|
templ Index(curSong *radio.Song, sl []radio.Song, slLen int64, lstnrs *radio.ListenerCounter, r *http.Request) {
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
<meta name="theme-color" content="#cd2682" />
|
|
|
|
<meta name="color-scheme" content="light dark" />
|
|
|
|
|
|
|
|
<title>Arav's dwelling / Radio</title>
|
|
|
|
|
|
|
|
<meta name="author" content={ "Alexander \"Arav\" Andreev" } />
|
|
|
|
<meta name="description" content="Internet-radio broadcasting from under my desk." />
|
|
|
|
<meta name="keywords" content="self-host radio home-radio various music" />
|
|
|
|
|
|
|
|
<link rel="canonical" href={ utils.Site(r.Host) } />
|
|
|
|
|
|
|
|
<link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml" />
|
|
|
|
<link rel="stylesheet" href="/assets/css/main.css" />
|
|
|
|
|
|
|
|
<script src="/assets/js/main.js" defer />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<header>
|
|
|
|
<svg viewBox="0 -25 216 40">
|
|
|
|
<text>Arav's dwelling</text>
|
|
|
|
<text y="11">Welcome to my sacred place, wanderer</text>
|
|
|
|
</svg>
|
|
|
|
<nav>
|
2024-05-10 02:48:47 +04:00
|
|
|
<a href={ templ.SafeURL(utils.MainSite(r.Host)) }>Back to home</a>
|
2024-05-10 00:11:33 +04:00
|
|
|
<h1>Radio</h1>
|
|
|
|
</nav>
|
|
|
|
</header>
|
|
|
|
<section id="banner">
|
|
|
|
<video playsinline autoplay loop muted>
|
|
|
|
<source src="/assets/img/stopit.mp4" type="video/mp4" />
|
|
|
|
</video>
|
|
|
|
</section>
|
|
|
|
<section>
|
|
|
|
<div class="small player-links">
|
|
|
|
<a href="/filelist">filelist</a>
|
|
|
|
<a href="/playlist">playlist</a>
|
|
|
|
<a href="/live/stream.ogg">direct link</a>
|
|
|
|
(<a href="http://radio.arav.su:8000/stream.ogg">http</a>
|
|
|
|
<a href="http://wsmkgnmhmzqm7kyzv7jnzzafvgm7xlmlfvzhgorpapd5or2arnhuktqd.onion/live/stream.ogg">Tor</a>
|
|
|
|
<a href="http://radio.arav.i2p/live/stream.ogg">I2P</a>
|
|
|
|
<a href="http://[300:a98d:d6d0:8a08::e]/live/stream.ogg">Ygg</a>)
|
|
|
|
<a href="https://dir.xiph.org/search?q=arav's+dwelling">Xiph</a>
|
|
|
|
| OGG 128 Kb/s
|
|
|
|
</div>
|
|
|
|
<div id="player">
|
|
|
|
<div>
|
|
|
|
<button id="radio-play" />
|
|
|
|
<input id="radio-volume" type="range" min="0" max="100" orient="vertical" />
|
|
|
|
</div>
|
2024-05-10 04:37:25 +04:00
|
|
|
<audio preload="none" controls playsinline>
|
2024-05-10 00:11:33 +04:00
|
|
|
<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</a>!
|
|
|
|
</audio>
|
|
|
|
<div>
|
2024-05-11 05:03:20 +04:00
|
|
|
if curSong != nil && curSong.Artist != "" {
|
|
|
|
<p>
|
2024-05-12 03:58:35 +04:00
|
|
|
<b>Listeners:</b> <span id="radio-listeners">{ strconv.FormatInt(lstnrs.Current(), 10) }</span>
|
|
|
|
<b>Duration:</b> <span id="radio-duration-estimate"></span><span id="radio-duration">{ curSong.DurationString() }</span>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<b>Song:</b> <span id="radio-song">{ curSong.Artist } - { curSong.Title }</span>
|
2024-05-11 05:03:20 +04:00
|
|
|
</p>
|
2024-05-10 00:11:33 +04:00
|
|
|
} else {
|
2024-05-11 05:03:20 +04:00
|
|
|
<p>
|
2024-05-12 03:58:35 +04:00
|
|
|
<b>Listeners:</b> <span id="radio-listeners">{ strconv.FormatInt(lstnrs.Current(), 10) }</span>
|
|
|
|
<b>Duration:</b> <span id="radio-duration-estimate"></span><span id="radio-duration">0:00</span>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<b>Song:</b> <span id="radio-song">-</span>
|
2024-05-11 05:03:20 +04:00
|
|
|
</p>
|
2024-05-10 00:11:33 +04:00
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<section>
|
|
|
|
<h2>Last { strconv.FormatInt(slLen, 10) } songs</h2>
|
|
|
|
<table id="last-songs">
|
|
|
|
<thead class="small">
|
|
|
|
<tr>
|
|
|
|
<td>Start</td>
|
2024-05-11 04:52:40 +04:00
|
|
|
<td><abbr title="Overall/Peak listeners">O/P</abbr></td>
|
2024-05-10 00:11:33 +04:00
|
|
|
<td>Song</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2024-05-11 05:34:32 +04:00
|
|
|
if sl != nil && len(sl) != 0 {
|
2024-05-10 04:59:18 +04:00
|
|
|
for i := 0; i < len(sl); i++ {
|
2024-05-10 00:11:33 +04:00
|
|
|
<tr>
|
2024-05-10 04:59:18 +04:00
|
|
|
<td>{ utils.ToClientTimezone(sl[i].StartAt, r).Format("15:04") }</td>
|
2024-05-11 04:52:40 +04:00
|
|
|
if sl[i].PeakListeners != 0 {
|
|
|
|
<td>{ strconv.FormatInt(sl[i].Listeners, 10) }/{ strconv.FormatInt(sl[i].PeakListeners, 10) }</td>
|
2024-05-10 00:11:33 +04:00
|
|
|
} else {
|
|
|
|
<td></td>
|
|
|
|
}
|
2024-05-10 04:59:18 +04:00
|
|
|
<td>{ sl[i].Artist } - { sl[i].Title }</td>
|
2024-05-10 00:11:33 +04:00
|
|
|
</tr>
|
|
|
|
}
|
2024-05-11 05:34:32 +04:00
|
|
|
}
|
2024-05-10 00:11:33 +04:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</section>
|
|
|
|
<footer>
|
2024-05-10 02:48:47 +04:00
|
|
|
2017—2024 Alexander "Arav" Andreev <<a href="mailto:me@arav.su">me@arav.su</a>> <a href={ templ.SafeURL(utils.MainSite(r.Host) + "/privacy") }>Privacy statements</a>
|
2024-05-10 00:11:33 +04:00
|
|
|
</footer>
|
|
|
|
</body>
|
|
|
|
</html>
|
2024-05-10 00:13:12 +04:00
|
|
|
}
|