Outils du site


Afficher sur un site ce qui est joué

Vous voudrez peut-être afficher sur votre site web ce que la radio est en train de jouer. Mettez alors ceci dans /var/icecast/web/all.xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="*">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>

Ensuite, dans un fichier /var/icecast/web/onair.xsl, mettez :

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>

<xsl:template match="/icestats">
<!-- only show the first source -->
<xsl:apply-templates select="source[1]"/>
</xsl:template>

<xsl:template match="source">
<xsl:choose>
<xsl:when test="title or artist">
<xsl:if test="artist"><xsl:value-of select="artist" /> - </xsl:if>
<xsl:value-of select="title" />
</xsl:when>
<xsl:otherwise>Unknown</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>

Les personnes allant sur http://chezmoi.tld:8000/onair.xsl pourront voir ce qui est joué. Dans votre code html, il suffirait alors de rajouter ceci pour l'afficher sur une page:

<h3>Now playing</h3>
<iframe id="icecast" src="http://chezmoi.tld:8000/onair.xsl">
</iframe>
<audio src="http://chezmoi.tld:8000/live.ogg" controls="controls"></audio>