<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://script.quakenet.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Shoutcast_status_script</id>
	<title>Shoutcast status script - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://script.quakenet.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Shoutcast_status_script"/>
	<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Shoutcast_status_script&amp;action=history"/>
	<updated>2026-05-14T14:24:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Shoutcast_status_script&amp;diff=3893&amp;oldid=prev</id>
		<title>Albie at 19:33, 27 November 2005</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Shoutcast_status_script&amp;diff=3893&amp;oldid=prev"/>
		<updated>2005-11-27T19:33:21Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Do you have an aspiring web-radio? You can use this script to tell your listeners what song they&amp;#039;re currently listening to and how many other users are enjoying your show.&lt;br /&gt;
&lt;br /&gt;
 ; Using this on TEXT event we can react to users who&lt;br /&gt;
 ; write !status in your channel. Do not forget to replace #your-channel&lt;br /&gt;
 ; with your actual channel&lt;br /&gt;
 on *:[[on_text|text]]:!status:#your-channel:{&lt;br /&gt;
   ; We store the channel&amp;#039;s name in a variable so we know where to send&lt;br /&gt;
   ; the replies to.&lt;br /&gt;
   [[set]] %radiochan $chan&lt;br /&gt;
 &lt;br /&gt;
   ; Open a connection to the radio&amp;#039;s web-server.&lt;br /&gt;
   ; Replace &amp;#039;your-radio.example.org&amp;#039; with your radio&amp;#039;s host&lt;br /&gt;
   ; and 8000 with its actual port.&lt;br /&gt;
   [[sockopen]] getsong your-radio.example.org 8000&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; The webserver has accepted our connection attempt.&lt;br /&gt;
 on *:[[on_sockopen|SOCKOPEN]]:getsong: {&lt;br /&gt;
   ; We will now send a simple HTTP request to collect statistics about the radio.&lt;br /&gt;
   [[sockwrite]] -n [[$sockname]] GET /7 HTTP/1.0&lt;br /&gt;
   sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a2) Gecko&lt;br /&gt;
   sockwrite -n $sockname&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; This gets triggered when the webserver replies to our HTTP request.&lt;br /&gt;
 on *:[[on_sockread|SOCKREAD]]:getsong: {&lt;br /&gt;
   ; Read a single line from the response and store it in %sctext&lt;br /&gt;
   [[sockread]] %sctext&lt;br /&gt;
 &lt;br /&gt;
   ; While there&amp;#039;s still remaining data in the response...&lt;br /&gt;
   [[while]] ([[$sockbr]]) {&lt;br /&gt;
     ; ... read it ...&lt;br /&gt;
     sockread -f %sctext&lt;br /&gt;
     ; and append it to %a&lt;br /&gt;
     [[var]] %a = %a %sctext&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Check whether we&amp;#039;ve found the right line in the response&lt;br /&gt;
   ; The line should be like &amp;lt;html&amp;gt;&amp;lt;body&amp;gt;information about the stream&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;br /&gt;
   [[If-Then-Else|if]] (&amp;lt;body&amp;gt; [[isin]] %a) {&lt;br /&gt;
     ; Extract the information from %a&lt;br /&gt;
     ; .echo -q will tell mirc not to show the result of $regex&lt;br /&gt;
     .[[echo]] -q [[$regex]](%a, /&amp;lt;body&amp;gt;(.*)&amp;lt;/body&amp;gt;/)&lt;br /&gt;
 &lt;br /&gt;
     ; Use /msg to tell the users about the stream&amp;#039;s status.&lt;br /&gt;
     if (%radiochan) { [[msg]] %radiochan [[$regml]](1) }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
[[Category:Script Archive]]&lt;/div&gt;</summary>
		<author><name>Albie</name></author>
	</entry>
</feed>