[xiph-commits] r8352 - in icecast/branches/kh/icecast: admin conf src win32

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Wed Dec 8 05:46:55 PST 2004


Author: karl
Date: 2004-12-08 05:46:54 -0800 (Wed, 08 Dec 2004)
New Revision: 8352

Added:
   icecast/branches/kh/icecast/admin/updatemetadata.xsl
Modified:
   icecast/branches/kh/icecast/admin/Makefile.am
   icecast/branches/kh/icecast/admin/listclients.xsl
   icecast/branches/kh/icecast/admin/listmounts.xsl
   icecast/branches/kh/icecast/admin/manageauth.xsl
   icecast/branches/kh/icecast/admin/stats.xsl
   icecast/branches/kh/icecast/conf/icecast_minimal.xml.in
   icecast/branches/kh/icecast/src/admin.c
   icecast/branches/kh/icecast/src/cfgfile.c
   icecast/branches/kh/icecast/src/cfgfile.h
   icecast/branches/kh/icecast/src/format_ogg.c
   icecast/branches/kh/icecast/src/yp.c
   icecast/branches/kh/icecast/src/yp.h
   icecast/branches/kh/icecast/win32/Icecast2winDlg.cpp
   icecast/branches/kh/icecast/win32/icecast.dsp
Log:
resync with changes made in trunk


Modified: icecast/branches/kh/icecast/admin/Makefile.am
===================================================================
--- icecast/branches/kh/icecast/admin/Makefile.am	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/admin/Makefile.am	2004-12-08 13:46:54 UTC (rev 8352)
@@ -4,5 +4,5 @@
 
 admindir = $(pkgdatadir)/admin
 dist_admin_DATA = listclients.xsl listmounts.xsl moveclients.xsl response.xsl \
-	stats.xsl manageauth.xsl
+	stats.xsl manageauth.xsl updatemetadata.xsl
 

Modified: icecast/branches/kh/icecast/admin/listclients.xsl
===================================================================
--- icecast/branches/kh/icecast/admin/listclients.xsl	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/admin/listclients.xsl	2004-12-08 13:46:54 UTC (rev 8352)
@@ -33,6 +33,7 @@
 	    <td align="center">
 		<a class="nav2" href="listclients.xsl?mount={@mount}">Show Listeners</a> | 
         	<a class="nav2" href="moveclients.xsl?mount={@mount}">Move Listeners</a> | 
+		<a class="nav2" href="updatemetadata.xsl?mount={@mount}">Update Metadata</a> |
         	<a class="nav2" href="killsource.xsl?mount={@mount}">Kill Source</a>
 	    </td></tr>
 	</table>

Modified: icecast/branches/kh/icecast/admin/listmounts.xsl
===================================================================
--- icecast/branches/kh/icecast/admin/listmounts.xsl	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/admin/listmounts.xsl	2004-12-08 13:46:54 UTC (rev 8352)
@@ -35,6 +35,7 @@
 	    <td align="center">
 		<a class="nav2" href="listclients.xsl?mount={@mount}">Show Listeners</a> | 
         	<a class="nav2" href="moveclients.xsl?mount={@mount}">Move Listeners</a> | 
+		<a class="nav2" href="updatemetadata.xsl?mount={@mount}">Update Metadata</a> |
         	<a class="nav2" href="killsource.xsl?mount={@mount}">Kill Source</a>
                 <xsl:if test="authenticator"> | <a class="nav2" href="manageauth.xsl?mount={@mount}">Manage Authentication</a></xsl:if>
 	    </td></tr>

Modified: icecast/branches/kh/icecast/admin/manageauth.xsl
===================================================================
--- icecast/branches/kh/icecast/admin/manageauth.xsl	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/admin/manageauth.xsl	2004-12-08 13:46:54 UTC (rev 8352)
@@ -36,6 +36,7 @@
 	    <td align="center">
 		<a class="nav2" href="listclients.xsl?mount={@mount}">Show Listeners</a> | 
         	<a class="nav2" href="moveclients.xsl?mount={@mount}">Move Listeners</a> | 
+		<a class="nav2" href="updatemetadata.xsl?mount={@mount}">Update Metadata</a> |
         	<a class="nav2" href="killsource.xsl?mount={@mount}">Kill Source</a>
 	    </td></tr>
 	</table>

Modified: icecast/branches/kh/icecast/admin/stats.xsl
===================================================================
--- icecast/branches/kh/icecast/admin/stats.xsl	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/admin/stats.xsl	2004-12-08 13:46:54 UTC (rev 8352)
@@ -62,6 +62,7 @@
 	    <td align="center">
 		<a class="nav2" href="listclients.xsl?mount={@mount}">List Clients</a> | 
         	<a class="nav2" href="moveclients.xsl?mount={@mount}">Move MountPoints</a> | 
+        	<a class="nav2" href="updatemetadata.xsl?mount={@mount}">Update Metadata</a> |
         	<a class="nav2" href="killsource.xsl?mount={@mount}">Kill Source</a>
                 <xsl:if test="authenticator"> | <a class="nav2" href="manageauth.xsl?mount={@mount}">Manage Authentication</a></xsl:if>
 	    </td></tr>

Added: icecast/branches/kh/icecast/admin/updatemetadata.xsl
===================================================================
--- icecast/branches/kh/icecast/admin/updatemetadata.xsl	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/admin/updatemetadata.xsl	2004-12-08 13:46:54 UTC (rev 8352)
@@ -0,0 +1,55 @@
+<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
+<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
+<xsl:template match = "/icestats" >
+<html>
+<head>
+<title>Icecast Streaming Media Server</title>
+<link rel="stylesheet" type="text/css" href="/style.css" />
+</head>
+<body>
+	<center>
+	<table border="0" cellpadding="1" cellspacing="3">
+	<tr>        
+	    <td align="center">
+		<a class="nav" href="listmounts.xsl">List MountPoints</a> | 
+        	<a class="nav" href="moveclients.xsl">Move Listeners</a> | 
+        	<a class="nav" href="stats.xsl">Stats</a> | 
+        	<a class="nav" href="/status.xsl">Status Page</a>
+	    </td></tr>
+	</table>
+	</center>
+<h2>Update Metadata</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img src="/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+<xsl:for-each select="source">
+<h3>
+<xsl:if test="server_name"><xsl:value-of select="server_name" /> </xsl:if>
+(<xsl:value-of select="@mount" />)</h3>
+
+<form method="GET" action="/admin/metadata.xsl">
+<table border="0" cellpadding="4">
+<tr><td>Metadata : <input type="text" name="song"/></td></tr>
+<tr><td><input type="Submit" value="Update"/></td></tr>
+</table>
+<input type="hidden" name="mount" value="{@mount}"/>
+<input type="hidden" name="mode" value="updinfo"/>
+</form>
+
+<br />
+<br />
+</xsl:for-each>
+<xsl:text disable-output-escaping="yes">&amp;</xsl:text>nbsp;
+</div>
+<div class="roundbottom">
+<img src="/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>
+</div>
+<div class="poster">
+<img align="left" src="/icecast.png" />Support icecast development at <a class="nav" href="http://www.icecast.org">www.icecast.org</a></div>
+</body>
+</html>
+</xsl:template>
+</xsl:stylesheet>

Modified: icecast/branches/kh/icecast/conf/icecast_minimal.xml.in
===================================================================
--- icecast/branches/kh/icecast/conf/icecast_minimal.xml.in	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/conf/icecast_minimal.xml.in	2004-12-08 13:46:54 UTC (rev 8352)
@@ -25,13 +25,11 @@
         <logdir>@localstatedir@/log/@PACKAGE@</logdir>
         <webroot>@pkgdatadir@/web</webroot>
         <adminroot>@pkgdatadir@/admin</adminroot>
+        <alias source="/" dest="/status.xsl"/>
     </paths>
     <logging>
         <accesslog>access.log</accesslog>
         <errorlog>error.log</errorlog>
       	<loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
     </logging>
-    <security>
-        <chroot>0</chroot>
-    </security>
 </icecast>

Modified: icecast/branches/kh/icecast/src/admin.c
===================================================================
--- icecast/branches/kh/icecast/src/admin.c	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/src/admin.c	2004-12-08 13:46:54 UTC (rev 8352)
@@ -47,16 +47,19 @@
 
 /* Mount-specific commands */
 #define COMMAND_RAW_FALLBACK        1
-#define COMMAND_METADATA_UPDATE     2
+#define COMMAND_RAW_METADATA_UPDATE 2
 #define COMMAND_RAW_SHOW_LISTENERS  3
 #define COMMAND_RAW_MOVE_CLIENTS    4
 #define COMMAND_RAW_MANAGEAUTH      5
 #define COMMAND_SHOUTCAST_METADATA_UPDATE   6
+#define COMMAND_RAW_UPDATEMETADATA  7
 
 #define COMMAND_TRANSFORMED_FALLBACK        50
 #define COMMAND_TRANSFORMED_SHOW_LISTENERS  53
 #define COMMAND_TRANSFORMED_MOVE_CLIENTS    54
 #define COMMAND_TRANSFORMED_MANAGEAUTH      55
+#define COMMAND_TRANSFORMED_UPDATEMETADATA  56
+#define COMMAND_TRANSFORMED_METADATA_UPDATE 57
 
 /* Global commands */
 #define COMMAND_RAW_LIST_MOUNTS             101
@@ -81,7 +84,8 @@
 #define FALLBACK_RAW_REQUEST "fallbacks"
 #define FALLBACK_TRANSFORMED_REQUEST "fallbacks.xsl"
 #define SHOUTCAST_METADATA_REQUEST "admin.cgi"
-#define METADATA_REQUEST "metadata"
+#define METADATA_RAW_REQUEST "metadata"
+#define METADATA_TRANSFORMED_REQUEST "metadata.xsl"
 #define LISTCLIENTS_RAW_REQUEST "listclients"
 #define LISTCLIENTS_TRANSFORMED_REQUEST "listclients.xsl"
 #define STATS_RAW_REQUEST "stats"
@@ -100,6 +104,8 @@
 #define ADMIN_XSL_RESPONSE "response.xsl"
 #define MANAGEAUTH_RAW_REQUEST "manageauth"
 #define MANAGEAUTH_TRANSFORMED_REQUEST "manageauth.xsl"
+#define UPDATEMETADATA_RAW_REQUEST "updatemetadata"
+#define UPDATEMETADATA_TRANSFORMED_REQUEST "updatemetadata.xsl"
 #define ADM_FUNCTION_RAW_REQUEST "function"
 #define ADM_FUNCTION_TRANSFORMED_REQUEST "function.xsl"
 #define DEFAULT_RAW_REQUEST ""
@@ -116,8 +122,10 @@
         return COMMAND_RAW_FALLBACK;
     else if(!strcmp(command, FALLBACK_TRANSFORMED_REQUEST))
         return COMMAND_TRANSFORMED_FALLBACK;
-    else if(!strcmp(command, METADATA_REQUEST))
-        return COMMAND_METADATA_UPDATE;
+    else if(!strcmp(command, METADATA_RAW_REQUEST))
+        return COMMAND_RAW_METADATA_UPDATE;
+    else if(!strcmp(command, METADATA_TRANSFORMED_REQUEST))
+        return COMMAND_TRANSFORMED_METADATA_UPDATE;
     else if(!strcmp(command, SHOUTCAST_METADATA_REQUEST))
         return COMMAND_SHOUTCAST_METADATA_UPDATE;
     else if(!strcmp(command, LISTCLIENTS_RAW_REQUEST))
@@ -154,6 +162,10 @@
         return COMMAND_RAW_MANAGEAUTH;
     else if(!strcmp(command, MANAGEAUTH_TRANSFORMED_REQUEST))
         return COMMAND_TRANSFORMED_MANAGEAUTH;
+    else if(!strcmp(command, UPDATEMETADATA_RAW_REQUEST))
+        return COMMAND_RAW_UPDATEMETADATA;
+    else if(!strcmp(command, UPDATEMETADATA_TRANSFORMED_REQUEST))
+        return COMMAND_TRANSFORMED_UPDATEMETADATA;
     else if(!strcmp(command, BUILDM3U_RAW_REQUEST))
         return COMMAND_BUILDM3U;
     else if(!strcmp(command, ADM_FUNCTION_RAW_REQUEST))
@@ -169,7 +181,7 @@
 }
 
 static void command_fallback(client_t *client, source_t *source, int response);
-static void command_metadata(client_t *client, source_t *source);
+static void command_metadata(client_t *client, source_t *source, int response);
 static void command_shoutcast_metadata(client_t *client, source_t *source);
 static void command_show_listeners(client_t *client, source_t *source,
         int response);
@@ -185,6 +197,8 @@
         int response);
 static void command_kill_source(client_t *client, source_t *source,
         int response);
+static void command_updatemetadata(client_t *client, source_t *source,
+        int response);
 static void command_admin_function (client_t *client, int response);
 
 static void admin_handle_mount_request(client_t *client, source_t *source,
@@ -469,9 +483,12 @@
         case COMMAND_RAW_FALLBACK:
             command_fallback(client, source, RAW);
             break;
-        case COMMAND_METADATA_UPDATE:
-            command_metadata(client, source);
+        case COMMAND_RAW_METADATA_UPDATE:
+            command_metadata(client, source, RAW);
             break;
+        case COMMAND_TRANSFORMED_METADATA_UPDATE:
+            command_metadata(client, source, TRANSFORMED);
+            break;
         case COMMAND_SHOUTCAST_METADATA_UPDATE:
             command_shoutcast_metadata(client, source);
             break;
@@ -508,6 +525,12 @@
         case COMMAND_RAW_MANAGEAUTH:
             command_manageauth(client, source, RAW);
             break;
+        case COMMAND_TRANSFORMED_UPDATEMETADATA:
+            command_updatemetadata(client, source, TRANSFORMED);
+            break;
+        case COMMAND_RAW_UPDATEMETADATA:
+            command_updatemetadata(client, source, RAW);
+            break;
         case COMMAND_BUILDM3U:
             command_buildm3u(client, source, RAW);
             break;
@@ -900,12 +923,19 @@
     html_success(client, "Fallback configured");
 }
 
-static void command_metadata(client_t *client, source_t *source)
+static void command_metadata(client_t *client, source_t *source,
+    int response)
 {
     char *action;
     char *song, *title, *artist;
     format_plugin_t *plugin;
+    xmlDocPtr doc;
+    xmlNodePtr node;
 
+    doc = xmlNewDoc("1.0");
+    node = xmlNewDocNode(doc, NULL, "iceresponse", NULL);
+    xmlDocSetRootElement(doc, node);
+
     DEBUG0("Got metadata update request");
 
     COMMAND_REQUIRE(client, "mode", action);
@@ -915,13 +945,19 @@
 
     if (strcmp (action, "updinfo") != 0)
     {
-        client_send_400 (client, "No such action");
+        xmlNewChild(node, NULL, "message", "No such action");
+        xmlNewChild(node, NULL, "return", "0");
+        admin_send_response(doc, client, response,
+            ADMIN_XSL_RESPONSE);
+        xmlFreeDoc(doc);
+        client_destroy(client);
         return;
     }
 
     thread_mutex_lock (&source->lock);
 
     plugin = source->format;
+
     if (plugin && plugin->set_tag)
     {
         if (song)
@@ -941,13 +977,26 @@
         }
 
         thread_mutex_unlock (&source->lock);
-        html_success(client, "Metadata update successful");
     }
     else
     {
         thread_mutex_unlock (&source->lock);
-        client_send_400 (client, "mountpoint will not accept URL updates");
+        xmlNewChild(node, NULL, "message", 
+            "Mountpoint will not accept URL updates");
+        xmlNewChild(node, NULL, "return", "1");
+        admin_send_response(doc, client, response, 
+            ADMIN_XSL_RESPONSE);
+        xmlFreeDoc(doc);
+        client_destroy(client);
+        return;
     }
+
+    xmlNewChild(node, NULL, "message", "Metadata update successful");
+    xmlNewChild(node, NULL, "return", "1");
+    admin_send_response(doc, client, response, 
+        ADMIN_XSL_RESPONSE);
+    xmlFreeDoc(doc);
+    client_destroy(client);
 }
 
 static void command_shoutcast_metadata(client_t *client, source_t *source)
@@ -1049,3 +1098,21 @@
     return;
 }
 
+static void command_updatemetadata(client_t *client, source_t *source,
+    int response)
+{
+    xmlDocPtr doc;
+    xmlNodePtr node, srcnode;
+
+    doc = xmlNewDoc("1.0");
+    node = xmlNewDocNode(doc, NULL, "icestats", NULL);
+    srcnode = xmlNewChild(node, NULL, "source", NULL);
+    xmlSetProp(srcnode, "mount", source->mount);
+    xmlDocSetRootElement(doc, node);
+
+    admin_send_response(doc, client, response, 
+        UPDATEMETADATA_TRANSFORMED_REQUEST);
+    xmlFreeDoc(doc);
+    client_destroy(client);
+}
+

Modified: icecast/branches/kh/icecast/src/cfgfile.c
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.c	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/src/cfgfile.c	2004-12-08 13:46:54 UTC (rev 8352)
@@ -193,6 +193,9 @@
         xmlFree(mount->on_connect);
         xmlFree(mount->on_disconnect);
         xmlFree(mount->fallback_mount);
+        if (mount->cluster_password) {
+            xmlFree(mount->cluster_password);
+        }
 
         xmlFree(mount->auth_type);
         option = mount->auth_options;
@@ -664,6 +667,10 @@
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->burst_size = atoi(tmp);
             if (tmp) xmlFree(tmp);
+        } else if (strcmp(node->name, "cluster-password") == 0) {
+            tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+            mount->cluster_password = (char *)xmlNodeListGetString(
+                    doc, node->xmlChildrenNode, 1);
         }
     } while ((node = node->next));
 }

Modified: icecast/branches/kh/icecast/src/cfgfile.h
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.h	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/src/cfgfile.h	2004-12-08 13:46:54 UTC (rev 8352)
@@ -67,6 +67,7 @@
     int mp3_meta_interval; /* outgoing per-stream metadata interval */
 
     char *auth_type; /* Authentication type */
+    char *cluster_password;
     config_options_t *auth_options; /* Options for this type */
     char *on_connect;
     char *on_disconnect;

Modified: icecast/branches/kh/icecast/src/format_ogg.c
===================================================================
--- icecast/branches/kh/icecast/src/format_ogg.c	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/src/format_ogg.c	2004-12-08 13:46:54 UTC (rev 8352)
@@ -40,6 +40,10 @@
 #ifdef HAVE_SPEEX
 #include "format_speex.h"
 #endif
+
+#ifdef _WIN32
+#define snprintf _snprintf
+#endif
 
 #define CATMODULE "format-ogg"
 #include "logging.h"

Modified: icecast/branches/kh/icecast/src/yp.c
===================================================================
--- icecast/branches/kh/icecast/src/yp.c	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/src/yp.c	2004-12-08 13:46:54 UTC (rev 8352)
@@ -479,6 +479,7 @@
         unsigned len = 512;
         int ret;
         char *url;
+        mount_proxy *mountproxy = NULL;
         ice_config_t *config;
 
         if (yp == NULL)
@@ -506,6 +507,18 @@
             if (s) url = s;
             snprintf (url, ret, "http://%s:%d%s", config->hostname, config->port, source->mount);
         }
+
+        mountproxy = config->mounts;
+        while (mountproxy) {
+            if (strcmp (mountproxy->mountname, source->mount) == 0) {
+                if (mountproxy->cluster_password) {
+                    add_yp_info (yp, "cluster_password", 
+                            mountproxy->cluster_password, YP_CLUSTER_PASSWORD);
+                }
+                break;
+            }
+            mountproxy = mountproxy->next;
+        }
         config_release_config();
         yp->listen_url = util_url_escape (url);
         free (url);
@@ -747,6 +760,9 @@
         if (ypdata->audio_info) {
             free(ypdata->audio_info);
         }
+        if (ypdata->cluster_password) {
+            free(ypdata->cluster_password);
+        }
         free (ypdata->error_msg);
         free (ypdata);
     }
@@ -836,6 +852,15 @@
                 stats_event (yp->mount, "yp_currently_playing", (char *)info);
             }
             break;
+        case YP_CLUSTER_PASSWORD:
+            escaped = util_url_escape(info);
+            if (escaped)
+            {
+                if (yp->cluster_password)
+                    free (yp->cluster_password);
+                yp->cluster_password = escaped;
+            }
+            break;
     }
 }
 

Modified: icecast/branches/kh/icecast/src/yp.h
===================================================================
--- icecast/branches/kh/icecast/src/yp.h	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/src/yp.h	2004-12-08 13:46:54 UTC (rev 8352)
@@ -22,6 +22,7 @@
 #define  YP_AUDIO_INFO 6
 #define  YP_SERVER_TYPE 7
 #define  YP_CURRENT_SONG 8
+#define  YP_CLUSTER_PASSWORD 9
 
 struct source_tag;
 

Modified: icecast/branches/kh/icecast/win32/Icecast2winDlg.cpp
===================================================================
--- icecast/branches/kh/icecast/win32/Icecast2winDlg.cpp	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/win32/Icecast2winDlg.cpp	2004-12-08 13:46:54 UTC (rev 8352)
@@ -536,8 +536,7 @@
 
 			xmlDocPtr doc;
 
-			stats_get_xml(&doc);
-
+			stats_get_xml(&doc, 0);
 			xmlNodePtr cur;
 		    cur = xmlDocGetRootElement(doc); 
 

Modified: icecast/branches/kh/icecast/win32/icecast.dsp
===================================================================
--- icecast/branches/kh/icecast/win32/icecast.dsp	2004-12-08 11:42:40 UTC (rev 8351)
+++ icecast/branches/kh/icecast/win32/icecast.dsp	2004-12-08 13:46:54 UTC (rev 8352)
@@ -169,6 +169,22 @@
 # End Source File
 # Begin Source File
 
+SOURCE=..\src\format_ogg.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\format_ogg.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\format_theora.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\format_theora.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\src\format_vorbis.c
 # End Source File
 # Begin Source File



More information about the commits mailing list