[xiph-commits] r9748 - in icecast/branches/kh/icecast: doc src web

karl at svn.xiph.org karl at svn.xiph.org
Sat Aug 13 08:46:19 PDT 2005


Author: karl
Date: 2005-08-13 08:46:12 -0700 (Sat, 13 Aug 2005)
New Revision: 9748

Modified:
   icecast/branches/kh/icecast/doc/icecast2_listenerauth.html
   icecast/branches/kh/icecast/src/admin.c
   icecast/branches/kh/icecast/src/auth.c
   icecast/branches/kh/icecast/src/auth.h
   icecast/branches/kh/icecast/src/auth_url.c
   icecast/branches/kh/icecast/src/connection.c
   icecast/branches/kh/icecast/src/main.c
   icecast/branches/kh/icecast/src/source.c
   icecast/branches/kh/icecast/web/status.xsl
Log:
sync up with recent work on merging with trunk. Add artwork= check in
update metadata code in admin, takes a url


Modified: icecast/branches/kh/icecast/doc/icecast2_listenerauth.html
===================================================================
--- icecast/branches/kh/icecast/doc/icecast2_listenerauth.html	2005-08-13 08:30:48 UTC (rev 9747)
+++ icecast/branches/kh/icecast/doc/icecast2_listenerauth.html	2005-08-13 15:46:12 UTC (rev 9748)
@@ -81,10 +81,10 @@
     <mount>
         <mount-name>/example.ogg</mount-name>
         <authentication type="url">
-            <option name="start" value="http://myauthserver.com/stream_start.php"/>
-            <option name="end" value="http://myauthserver.com/stream_end.php"/>
-            <option name="add" value="http://myauthserver.com/listener_joined.php"/>
-            <option name="remove" value="http://myauthserver.com/listener_left.php"/>
+            <option name="mount_add" value="http://myauthserver.com/stream_start.php"/>
+            <option name="mount_remove" value="http://myauthserver.com/stream_end.php"/>
+            <option name="listener_add" value="http://myauthserver.com/listener_joined.php"/>
+            <option name="listener_remove" value="http://myauthserver.com/listener_left.php"/>
             <option name="username" value="user"/>
             <option name="password" value="pass"/>
             <option name="auth_header" value="icecast-auth-user: 1"/>
@@ -115,7 +115,7 @@
 <h3>add</h3>
 <p>This is most likely to be used if anything. When a listener connects, before anything is
 sent back to them, this request is processed.  The default action is to reject a listener
-unless the auth server sends back a response header which can be stated in the 'header' option
+unless the auth server sends back a response header which may be stated in the 'header' option
 </p>
 <p>POST details are</p>
 <pre>

Modified: icecast/branches/kh/icecast/src/admin.c
===================================================================
--- icecast/branches/kh/icecast/src/admin.c	2005-08-13 08:30:48 UTC (rev 9747)
+++ icecast/branches/kh/icecast/src/admin.c	2005-08-13 15:46:12 UTC (rev 9748)
@@ -568,14 +568,12 @@
 
 static void html_success(client_t *client, char *message)
 {
-    int bytes;
-
     client->respcode = 200;
-    bytes = snprintf (client->refbuf->data, client->refbuf->len,
+    snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
             "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" 
             "<html><head><title>Admin request successful</title></head>"
             "<body><p>%s</p></body></html>", message);
-    client->refbuf->len = bytes;
+    client->refbuf->len = strlen (client->refbuf->data);
     fserve_add_client (client, NULL);
 }
 
@@ -832,7 +830,6 @@
 {
     char *username = NULL;
     char *password = NULL;
-    int bytes;
     ice_config_t *config;
 
     COMMAND_REQUIRE(client, "username", username);
@@ -840,7 +837,7 @@
 
     client->respcode = 200;
     config = config_get_config();
-    bytes = snprintf (client->refbuf->data, client->refbuf->len,
+    snprintf (client->refbuf->data, client->refbuf->len,
         "HTTP/1.0 200 OK\r\n"
         "Content-Type: audio/x-mpegurl\r\n"
         "Content-Disposition = attachment; filename=listen.m3u\r\n\r\n" 
@@ -1018,8 +1015,7 @@
 static void command_metadata(client_t *client, source_t *source,
     int response)
 {
-    char *action;
-    char *song, *title, *artist;
+    char *song, *title, *artist, *artwork;
     format_plugin_t *plugin;
     xmlDocPtr doc;
     xmlNodePtr node;
@@ -1030,61 +1026,58 @@
 
     DEBUG0("Got metadata update request");
 
-    COMMAND_REQUIRE(client, "mode", action);
     COMMAND_OPTIONAL(client, "song", song);
     COMMAND_OPTIONAL(client, "title", title);
     COMMAND_OPTIONAL(client, "artist", artist);
+    COMMAND_OPTIONAL(client, "artwork", artwork);
 
-    if (strcmp (action, "updinfo") != 0)
-    {
-        xmlNewChild(node, NULL, "message", "No such action");
-        xmlNewChild(node, NULL, "return", "0");
-        admin_send_response(doc, client, response,
-            ADMIN_XSL_RESPONSE);
-        xmlFreeDoc(doc);
-        return;
-    }
-
     thread_mutex_lock (&source->lock);
 
     plugin = source->format;
 
-    if (plugin && plugin->set_tag)
+    do
     {
-        if (song)
+        if (plugin == NULL)
+            break;
+        if (artwork)
+            stats_event (source->mount, "artwork", artwork);
+        else if (plugin->set_tag)
         {
-            plugin->set_tag (plugin, "song", song);
-            INFO2("Metadata on mountpoint %s changed to \"%s\"", source->mount, song);
+            if (song)
+            {
+                plugin->set_tag (plugin, "song", song);
+                INFO2("Metadata on mountpoint %s changed to \"%s\"", source->mount, song);
+            }
+            else
+            {
+                if (artist && title)
+                {
+                    plugin->set_tag (plugin, "title", title);
+                    plugin->set_tag (plugin, "artist", artist);
+                    INFO3("Metadata on mountpoint %s changed to \"%s - %s\"",
+                            source->mount, artist, title);
+                }
+            }
         }
         else
         {
-            if (artist && title)
-            {
-                plugin->set_tag (plugin, "title", title);
-                plugin->set_tag (plugin, "artist", artist);
-                INFO3("Metadata on mountpoint %s changed to \"%s - %s\"",
-                        source->mount, artist, title);
-            }
+            break;
         }
-
         thread_mutex_unlock (&source->lock);
-    }
-    else
-    {
-        thread_mutex_unlock (&source->lock);
-        xmlNewChild(node, NULL, "message", 
-            "Mountpoint will not accept URL updates");
+        xmlNewChild(node, NULL, "message", "Metadata update successful");
         xmlNewChild(node, NULL, "return", "1");
         admin_send_response(doc, client, response, 
-            ADMIN_XSL_RESPONSE);
+                ADMIN_XSL_RESPONSE);
         xmlFreeDoc(doc);
         return;
-    }
 
-    xmlNewChild(node, NULL, "message", "Metadata update successful");
+    } while (0);
+    thread_mutex_unlock (&source->lock);
+    xmlNewChild(node, NULL, "message", 
+            "Mountpoint will not accept this URL update");
     xmlNewChild(node, NULL, "return", "1");
     admin_send_response(doc, client, response, 
-        ADMIN_XSL_RESPONSE);
+            ADMIN_XSL_RESPONSE);
     xmlFreeDoc(doc);
 }
 
@@ -1144,7 +1137,6 @@
     stats_get_xml(&doc, 1);
     admin_send_response (doc, client, response, xslfile+1);
     xmlFreeDoc(doc);
-    return;
 }
 
 static void command_list_mounts(client_t *client, int response)
@@ -1155,13 +1147,11 @@
     if (response == PLAINTEXT)
     {
         char *buf;
-        int remaining = 4096;
+        int remaining = PER_CLIENT_REFBUF_SIZE;
         int ret;
         ice_config_t *config = config_get_config ();
         mount_proxy *mountinfo = config->mounts;
 
-        client_set_queue (client, NULL);
-        client->refbuf = refbuf_new (remaining);
         buf = client->refbuf->data;
         ret = snprintf (buf, remaining,
                 "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n");
@@ -1197,7 +1187,7 @@
             remaining -= ret;
             buf += ret;
         }
-        client->refbuf->len = 4096 - remaining;
+        client->refbuf->len = PER_CLIENT_REFBUF_SIZE - remaining;
         fserve_add_client (client, NULL);
     }
     else

Modified: icecast/branches/kh/icecast/src/auth.c
===================================================================
--- icecast/branches/kh/icecast/src/auth.c	2005-08-13 08:30:48 UTC (rev 9747)
+++ icecast/branches/kh/icecast/src/auth.c	2005-08-13 15:46:12 UTC (rev 9748)
@@ -115,7 +115,7 @@
 
     if (authenticator->free)
         authenticator->free (authenticator);
-    free (authenticator->type);
+    xmlFree (authenticator->type);
     free (authenticator);
 }
 
@@ -441,6 +441,7 @@
 {
     do
     {
+        DEBUG1 ("type is %s", auth->type);
 #ifdef HAVE_AUTH_URL
         if (strcmp (auth->type, "url") == 0)
         {

Modified: icecast/branches/kh/icecast/src/auth.h
===================================================================
--- icecast/branches/kh/icecast/src/auth.h	2005-08-13 08:30:48 UTC (rev 9747)
+++ icecast/branches/kh/icecast/src/auth.h	2005-08-13 15:46:12 UTC (rev 9748)
@@ -76,6 +76,8 @@
 int  release_client (client_t *client);
 
 void auth_initialise ();
+void auth_shutdown ();
+
 auth_t  *auth_get_authenticator (xmlNodePtr node);
 void    auth_release (auth_t *authenticator);
 

Modified: icecast/branches/kh/icecast/src/auth_url.c
===================================================================
--- icecast/branches/kh/icecast/src/auth_url.c	2005-08-13 08:30:48 UTC (rev 9747)
+++ icecast/branches/kh/icecast/src/auth_url.c	2005-08-13 15:46:12 UTC (rev 9748)
@@ -93,7 +93,10 @@
 
 static void auth_url_clear(auth_t *self)
 {
-    auth_url *url = self->state;
+    auth_url *url;
+
+    INFO0 ("Doing auth URL cleanup");
+    url = self->state;
     curl_easy_cleanup (url->handle);
     free (url->username);
     free (url->password);
@@ -398,13 +401,13 @@
             url_info->username = strdup (options->value);
         if(!strcmp(options->name, "password"))
             url_info->password = strdup (options->value);
-        if(!strcmp(options->name, "add"))
+        if(!strcmp(options->name, "listener_add"))
             url_info->addurl = strdup (options->value);
-        if(!strcmp(options->name, "remove"))
+        if(!strcmp(options->name, "listener_remove"))
             url_info->removeurl = strdup (options->value);
-        if(!strcmp(options->name, "start"))
+        if(!strcmp(options->name, "mount_add"))
             url_info->stream_start = strdup (options->value);
-        if(!strcmp(options->name, "end"))
+        if(!strcmp(options->name, "mount_remove"))
             url_info->stream_end = strdup (options->value);
         if(!strcmp(options->name, "auth_header"))
         {

Modified: icecast/branches/kh/icecast/src/connection.c
===================================================================
--- icecast/branches/kh/icecast/src/connection.c	2005-08-13 08:30:48 UTC (rev 9747)
+++ icecast/branches/kh/icecast/src/connection.c	2005-08-13 15:46:12 UTC (rev 9748)
@@ -994,7 +994,6 @@
     }
 
     add_client (uri, client);
-
     if (uri != passed_uri) free (uri);
 }
 
@@ -1100,6 +1099,7 @@
         if (node)
         {
             client_t *client = node->client;
+
             /* Check for special shoutcast compatability processing */
             if (node->shoutcast)
             {

Modified: icecast/branches/kh/icecast/src/main.c
===================================================================
--- icecast/branches/kh/icecast/src/main.c	2005-08-13 08:30:48 UTC (rev 9747)
+++ icecast/branches/kh/icecast/src/main.c	2005-08-13 15:46:12 UTC (rev 9748)
@@ -49,6 +49,7 @@
 #include "xslt.h"
 #include "fserve.h"
 #include "yp.h"
+#include "auth.h"
 
 #include <libxml/xmlmemory.h>
 
@@ -108,18 +109,19 @@
     xslt_shutdown();
     refbuf_shutdown();
     slave_shutdown();
+    auth_shutdown();
     yp_shutdown();
     stats_shutdown();
 
-    /* Now that these are done, we can stop the loggers. */
-    _stop_logging();
-
     global_shutdown();
     connection_shutdown();
     config_shutdown();
     resolver_shutdown();
     sock_shutdown();
     thread_shutdown();
+
+    /* Now that these are done, we can stop the loggers. */
+    _stop_logging();
     log_shutdown();
 
     xmlCleanupParser();

Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c	2005-08-13 08:30:48 UTC (rev 9747)
+++ icecast/branches/kh/icecast/src/source.c	2005-08-13 15:46:12 UTC (rev 9748)
@@ -154,6 +154,7 @@
     while (mount && depth < MAX_FALLBACK_DEPTH)
     {
         source = source_find_mount_raw(mount);
+
         if (source)
         {
             if (source->running || source->on_demand)

Modified: icecast/branches/kh/icecast/web/status.xsl
===================================================================
--- icecast/branches/kh/icecast/web/status.xsl	2005-08-13 08:30:48 UTC (rev 9747)
+++ icecast/branches/kh/icecast/web/status.xsl	2005-08-13 15:46:12 UTC (rev 9748)
@@ -50,6 +50,13 @@
 </xsl:choose>
 (<xsl:value-of select="@mount" />)
 <xsl:if test="authenticator"> <a href="/auth.xsl"><img border="0" src="/images/key.png"/></a> </xsl:if>
+<xsl:if test="artwork">
+  <img border="0" alt="">
+  <xsl:attribute name="src">
+     <xsl:value-of select="artwork"/>
+  </xsl:attribute>
+ </img>
+</xsl:if>
 
 </h3>
 



More information about the commits mailing list