<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>DMF Radio</title>
    <link rel="stylesheet" type="text/css" href="style.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  </head>
  <body><h1 id="header">DMF Radio</h1><div id="menu"><ul><li><a href="admin/">Administration</a></li><li><a href="status.xsl">Server Status</a></li><li><a href="server_version.xsl">Version</a></li></ul></div>
	<!-- WARNING:
	 DO NOT ATTEMPT TO PARSE ICECAST HTML OUTPUT!
	 The web interface may change completely between releases.
	 If you have a need for automatic processing of server data,
	 please read the appropriate documentation. Latest docs:
	 https://icecast.org/docs/icecast-latest/icecast2_stats.html
	-->
	<div class="roundbox"><div class="mounthead"><div class="right"><ul class="mountlist"><li><a class="play" href="/dmfradio.m3u">M3U</a></li><li><a class="play" href="/dmfradio.xspf">XSPF</a></li></ul></div></div><div class="mountcont"><div class="audioplayer"><audio controls="controls" preload="none"><source src="/dmfradio" type="audio/mpeg"></source></audio></div><table class="yellowkeys"><tbody><tr><td>Demoscene Music Forever Radio</td></tr><p>playing: <span id="current-song">Betöltés...</span></p></tbody></table></div></div><script type="text/javascript">
// 
function updateSongTitle() {
    fetch('/status-json.xsl')
        .then(response =&gt; response.json())
        .then(data =&gt; {
            if (data.icestats &amp;&amp; data.icestats.source) {
                let sources = data.icestats.source;
                let currentSong = "Nincs adás";

                if (Array.isArray(sources)) {
                    // Ha több mountpoint van, az első aktív címét vesszük el
                    currentSong = sources[0].title || "Ismeretlen szám";
                } else {
                    currentSong = sources.title || "Ismeretlen szám";
                }

                document.getElementById('current-song').innerText = currentSong;
            }
        })
        .catch(error =&gt; {
            console.error('Hiba a lekérés során:', error);
        });
}

// Azonnali futtatás és időzítés beállítása 5 másodpercre
updateSongTitle();
setInterval(updateSongTitle, 5000);
// 
</script></body>
</html>
