67 lines
1.9 KiB
HTML
67 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Now Playing (Text Only)</title>
|
|
<style>
|
|
body {
|
|
font-family: sans-serif;
|
|
color: white;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
margin: 0;
|
|
padding: 20px;
|
|
border-radius: 10px;
|
|
}
|
|
#song-info {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
#title {
|
|
font-size: 24px;
|
|
font-weight: bold;
|
|
}
|
|
#artist {
|
|
font-size: 18px;
|
|
}
|
|
#annotation {
|
|
font-size: 12px;
|
|
margin-top: 10px;
|
|
color: #ccc;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="song-info">
|
|
<div id="title"></div>
|
|
<div id="artist"></div>
|
|
<div id="annotation">radio.ramforth.net</div>
|
|
</div>
|
|
|
|
<script>
|
|
const nowPlayingUrl = 'https://radio.ramforth.net/api/nowplaying/1';
|
|
|
|
function updateNowPlaying() {
|
|
fetch(nowPlayingUrl)
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
const song = data.now_playing.song;
|
|
document.getElementById('title').textContent = song.title;
|
|
document.getElementById('artist').textContent = song.artist;
|
|
})
|
|
.catch(error => {
|
|
console.error('Error fetching Now Playing data:', error);
|
|
document.getElementById('title').textContent = 'Error';
|
|
document.getElementById('artist').textContent = 'Could not fetch data';
|
|
});
|
|
}
|
|
|
|
// Update every 5 seconds
|
|
setInterval(updateNowPlaying, 5000);
|
|
|
|
// Initial update
|
|
updateNowPlaying();
|
|
</script>
|
|
</body>
|
|
</html>
|