Commit 17db41eb authored by Philipp Schafft's avatar Philipp Schafft 🦁

Added VCLT playlist support.

svn path=/icecast/trunk/icecast/; revision=18130
parent 759f55b3
2011-11-26 02:36 ph3-der-loewe
* trunk/icecast/src/fserve.c, trunk/icecast/admin/vclt.xsl,
trunk/icecast/web/status.xsl: Added VCLT playlist support.
2011-11-25 22:37 dm8tbr
* trunk/icecast/conf/icecast.xml.in:
......
<!--
VCLT xslt stylesheet for Icecast 2.3.2 and above
based on XSPF xslt stylesheet.
Copyright (C) 2007 Thomas B. Ruecker, tbr@ruecker-itk.de
Copyright (C) 2011 Philipp Schafft, lion@lion.leolix.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the
Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-->
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output omit-xml-declaration="yes" media-type="audio/x-vclt"
method="text" indent="no" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<xsl:for-each select="source">STREAMURL=<xsl:value-of select="listenurl" />
<xsl:if test="artist"><xsl:text>
</xsl:text>ARTIST=<xsl:value-of select="artist" /></xsl:if>
<xsl:if test="title"><xsl:text>
</xsl:text>TITLE=<xsl:value-of select="title" /></xsl:if>
<xsl:if test="server_name"><xsl:text>
</xsl:text>SERVER_NAME=<xsl:value-of select="server_name" /></xsl:if>
<xsl:if test="server_description"><xsl:text>
</xsl:text>DESCRIPTION=<xsl:value-of select="server_description" /></xsl:if>
SIGNALINFO=<xsl:choose>
<xsl:when test="server_type = 'application/ogg'">
<xsl:choose>
<xsl:when test="subtype = 'Vorbis'">codec:ogg_vorbis</xsl:when>
<!-- More codecs should be added here, however I don't know how to find out about the codec.
At the moment we just guess that application/ogg is a Ogg bitstream with some undefined
codec. Everything else is undefined.
-->
<xsl:otherwise>codec:ogg_general</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose><xsl:text>
</xsl:text>
<xsl:if test="genre">GENRE=<xsl:value-of select="genre" /></xsl:if>
==
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
......@@ -8,6 +8,7 @@
* oddsock <oddsock@xiph.org>,
* Karl Heyes <karl@xiph.org>
* and others (see AUTHORS for details).
* Copyright 2011, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>.
*/
#ifdef HAVE_CONFIG_H
......@@ -405,7 +406,8 @@ int fserve_client_create (client_t *httpclient, const char *path)
int ret = 0;
char *fullpath;
int m3u_requested = 0, m3u_file_available = 1;
int xspf_requested = 0, xspf_file_available = 1;
const char * xslt_playlist_requested = NULL;
int xslt_playlist_file_available = 1;
ice_config_t *config;
FILE *file;
......@@ -416,13 +418,16 @@ int fserve_client_create (client_t *httpclient, const char *path)
m3u_requested = 1;
if (strcmp (util_get_extension (fullpath), "xspf") == 0)
xspf_requested = 1;
xslt_playlist_requested = "xspf.xsl";
if (strcmp (util_get_extension (fullpath), "vclt") == 0)
xslt_playlist_requested = "vclt.xsl";
/* check for the actual file */
if (stat (fullpath, &file_buf) != 0)
{
/* the m3u can be generated, but send an m3u file if available */
if (m3u_requested == 0 && xspf_requested == 0)
if (m3u_requested == 0 && xslt_playlist_requested == NULL)
{
WARN2 ("req for file \"%s\" %s", fullpath, strerror (errno));
client_send_404 (httpclient, "The file you requested could not be found");
......@@ -430,7 +435,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
return -1;
}
m3u_file_available = 0;
xspf_file_available = 0;
xslt_playlist_file_available = 0;
}
httpclient->refbuf->len = PER_CLIENT_REFBUF_SIZE;
......@@ -477,7 +482,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
free (fullpath);
return 0;
}
if (xspf_requested && xspf_file_available == 0)
if (xslt_playlist_requested && xslt_playlist_file_available == 0)
{
xmlDocPtr doc;
char *reference = strdup (path);
......@@ -486,7 +491,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
*eol = '\0';
doc = stats_get_xml (0, reference);
free (reference);
admin_send_response (doc, httpclient, TRANSFORMED, "xspf.xsl");
admin_send_response (doc, httpclient, TRANSFORMED, xslt_playlist_requested);
xmlFreeDoc(doc);
return 0;
}
......
......@@ -49,7 +49,11 @@
<td align="right"><a class="auth" href="/auth.xsl">Login</a></td>
</xsl:when>
<xsl:otherwise>
<td align="right"> <a href="{@mount}.m3u">M3U</a> <a href="{@mount}.xspf">XSPF</a></td>
<td align="right">
<a href="{@mount}.m3u">M3U</a>
<a href="{@mount}.xspf">XSPF</a>
<a href="{@mount}.vclt">VCLT</a>
</td>
</xsl:otherwise>
</xsl:choose>
</tr></table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment