93 lines
3.8 KiB
Plaintext
93 lines
3.8 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title data-text="title">🎵 ASTEROID RADIO 🎵</title>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" type="text/css" href="/asteroid/static/asteroid.css">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=VT323&display=swap" rel="stylesheet">
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<header>
|
|
<h1 data-text="station-name">🎵 ASTEROID RADIO 🎵</h1>
|
|
<nav>
|
|
<a href="/asteroid/">Home</a>
|
|
<a href="/asteroid/player">Player</a>
|
|
<a href="/asteroid/admin">Admin</a>
|
|
<a href="/asteroid/status">Status</a>
|
|
<a href="/asteroid/login">Login</a>
|
|
<a href="/asteroid/register">Register</a>
|
|
</nav>
|
|
</header>
|
|
|
|
<main>
|
|
<div class="status">
|
|
<h2>Station Status</h2>
|
|
<p data-text="status-message">🟢 LIVE - Broadcasting asteroid music for hackers</p>
|
|
<p>Current listeners: <span data-text="listeners">0</span></p>
|
|
<p>Stream quality: <span data-text="stream-quality">128kbps MP3</span></p>
|
|
</div>
|
|
|
|
<div class="live-stream">
|
|
<h2>🔴 LIVE STREAM</h2>
|
|
<p><strong>Stream URL:</strong> <code>http://localhost:8000/asteroid.mp3</code></p>
|
|
<p><strong>Format:</strong> MP3 128kbps Stereo</p>
|
|
<p><strong>Status:</strong> <span style="color: #00ff00;">● BROADCASTING</span></p>
|
|
<audio controls style="width: 100%; margin: 10px 0;">
|
|
<source src="http://localhost:8000/asteroid.mp3" type="audio/mpeg">
|
|
Your browser does not support the audio element.
|
|
</audio>
|
|
</div>
|
|
|
|
<div class="now-playing">
|
|
<h2>Now Playing</h2>
|
|
<p>Artist: <span data-text="now-playing-artist">The Void</span></p>
|
|
<p>Track: <span data-text="now-playing-track">Silence</span></p>
|
|
<p>Listeners: <span data-text="listeners">0</span></p>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
<script>
|
|
// Update now playing info from Icecast
|
|
function updateNowPlaying() {
|
|
fetch('/asteroid/api/icecast-status')
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.icestats && data.icestats.source) {
|
|
// Find the high quality stream (asteroid.mp3)
|
|
const sources = Array.isArray(data.icestats.source) ? data.icestats.source : [data.icestats.source];
|
|
const mainStream = sources.find(s => s.listenurl && s.listenurl.includes('asteroid.mp3'));
|
|
|
|
if (mainStream && mainStream.title) {
|
|
// Parse "Artist - Track" format
|
|
const titleParts = mainStream.title.split(' - ');
|
|
const artist = titleParts.length > 1 ? titleParts[0] : 'Unknown Artist';
|
|
const track = titleParts.length > 1 ? titleParts.slice(1).join(' - ') : mainStream.title;
|
|
|
|
document.querySelector('[data-text="now-playing-artist"]').textContent = artist;
|
|
document.querySelector('[data-text="now-playing-track"]').textContent = track;
|
|
document.querySelector('[data-text="listeners"]').textContent = mainStream.listeners || '0';
|
|
|
|
// Update stream status
|
|
const statusElement = document.querySelector('.live-stream p:nth-child(3) span');
|
|
if (statusElement) {
|
|
statusElement.textContent = '● LIVE - ' + track;
|
|
statusElement.style.color = '#00ff00';
|
|
}
|
|
}
|
|
}
|
|
})
|
|
.catch(error => console.log('Could not fetch stream status:', error));
|
|
}
|
|
|
|
// Update every 10 seconds
|
|
updateNowPlaying();
|
|
setInterval(updateNowPlaying, 10000);
|
|
</script>
|
|
</body>
|
|
</html>
|