Hi all, I just wrote this script (attached) which I thought others might find useful -- it updates the song title of every mountpoint with the current number of listeners for that mount. It can be seen in action on http://radio.ethereal.net:8000/stale, where it runs every minute out of cron. The script should be self-explanatory, but feel free to write me privately with any questions or problems... there's obviously some room for improvement. thanks, Tris P.S. status2.xsl seems to have some bugs (use of old variable names), some of which I fixed in the attached patch. The patch shouldn't be needed to get the script to work, though. -------------- next part -------------- #!/usr/bin/perl -w # tristan+perl@ethereal.net 17apr2005 # public domain use strict; use URI::Escape; use LWP::UserAgent; my $mounts = '/.*'; my $user = 'source'; my $pass = 'changeme'; my $host = 'localhost:8000'; my $realm = 'Icecast2 Server'; my $maxclients = 100; my $ua = LWP::UserAgent->new; $ua->timeout(10); #$ua->env_proxy; my $res = $ua->get("http://$host/status2.xsl"); die $res->status_line unless $res->is_success; my $content = $res->content; $content =~ s|.*<pre>(.*)</pre>|$1|s; foreach my $line (split(/\n/, $content)) { if ($line =~ /^$mounts,/) { if ($line =~ /^([^,]*),[^,]*,[^,]*,(\d+),[^,]*, - (.*),$/) { my $mount = $1; my $listeners = $2; my $title = $3; $title =~ s|^\[\d+/\d+\] ||; my $newtitle = uri_escape("[$listeners/$maxclients] $title"); $ua->credentials($host, $realm, $user, $pass); my $res2 = $ua->get("http://$host/admin/metadata?mode=updinfo&mount=$mount&song=$newtitle"); warn $res2->status_line unless $res2->is_success; } } } -------------- next part -------------- --- status2.xsl~ 2004-10-12 19:28:26.000000000 -0700 +++ status2.xsl 2005-04-17 19:42:05.000000000 -0700 @@ -3,7 +3,7 @@ <xsl:template match = "/icestats" > <pre> MountPoint,Connections,Stream Name,Current Listeners,Description,Currently Playing,Stream URL -Global,Client:<xsl:value-of select="connections" /> Source: <xsl:value-of select="source_connections" />,,<xsl:value-of select="listeners" />,, +Global,Client:<xsl:value-of select="connections" /> Source: <xsl:value-of select="source_total_connections" />,,<xsl:value-of select="clients" />,, <xsl:for-each select="source"> <xsl:value-of select="@mount" />,,<xsl:value-of select="name" />,<xsl:value-of select="listeners" />,<xsl:value-of select="description" />,<xsl:value-of select="artist" /> - <xsl:value-of select="title" />,<xsl:value-of select="url" /> </xsl:for-each>