[xiph-commits] r18130 - in icecast/trunk/icecast: . admin src web

ph3-der-loewe at svn.xiph.org ph3-der-loewe at svn.xiph.org
Fri Nov 25 18:37:39 PST 2011


Author: ph3-der-loewe
Date: 2011-11-25 18:37:39 -0800 (Fri, 25 Nov 2011)
New Revision: 18130

Added:
   icecast/trunk/icecast/admin/vclt.xsl
Modified:
   icecast/trunk/icecast/ChangeLog
   icecast/trunk/icecast/src/fserve.c
   icecast/trunk/icecast/web/status.xsl
Log:
Added VCLT playlist support.

Modified: icecast/trunk/icecast/ChangeLog
===================================================================
--- icecast/trunk/icecast/ChangeLog	2011-11-25 22:41:54 UTC (rev 18129)
+++ icecast/trunk/icecast/ChangeLog	2011-11-26 02:37:39 UTC (rev 18130)
@@ -1,3 +1,8 @@
+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:

Added: icecast/trunk/icecast/admin/vclt.xsl
===================================================================
--- icecast/trunk/icecast/admin/vclt.xsl	                        (rev 0)
+++ icecast/trunk/icecast/admin/vclt.xsl	2011-11-26 02:37:39 UTC (rev 18130)
@@ -0,0 +1,54 @@
+<!--
+    VCLT xslt stylesheet for Icecast 2.3.2 and above
+    based on XSPF xslt stylesheet.
+    Copyright (C) 2007 Thomas B. Ruecker, tbr at ruecker-itk.de
+    Copyright (C) 2011 Philipp Schafft, lion at 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>

Modified: icecast/trunk/icecast/src/fserve.c
===================================================================
--- icecast/trunk/icecast/src/fserve.c	2011-11-25 22:41:54 UTC (rev 18129)
+++ icecast/trunk/icecast/src/fserve.c	2011-11-26 02:37:39 UTC (rev 18130)
@@ -8,6 +8,7 @@
  *                      oddsock <oddsock at xiph.org>,
  *                      Karl Heyes <karl at xiph.org>
  *                      and others (see AUTHORS for details).
+ * Copyright 2011,      Philipp "ph3-der-loewe" Schafft <lion at lion.leolix.org>.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -405,7 +406,8 @@
     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 @@
         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 @@
             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 @@
         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 @@
             *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;
     }

Modified: icecast/trunk/icecast/web/status.xsl
===================================================================
--- icecast/trunk/icecast/web/status.xsl	2011-11-25 22:41:54 UTC (rev 18129)
+++ icecast/trunk/icecast/web/status.xsl	2011-11-26 02:37:39 UTC (rev 18130)
@@ -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>



More information about the commits mailing list