SHOUTCast Script

By vinetio on Sep 06, 2007

This is a relativly simple SHOUTcast socket script which goes via dialog :D

NOTE:

  1. Change #YOUR-RADIO-CHANNEL to the IRC channel of the radio preferred.
  2. Change Host: 217.121.86.2:8001 to the server address + port of the radio server your a DJ/Listener on
  3. Feel free to add timers ;)

IMPORTANT:

It didn't work on my mIRC client where my BOT is on.. But on my client (Omerta Script) it did so I hope it works for you guys :p

alias radiostatus {
  /dialog -m rankstats rankstats
}

dialog rankstats { 
  title "Radio Stats" 
  size -1 -1 300 140 
  text Song: %nr.song,1,15 10 300 125 
  text Kbps: %nr.kbps kbps,2,15 25 250 125 
  text Listeners: %nr.listen,3,15 40 250 125
  text Max: %nr.max,4,15 55 250 125 
  text Top: %nr.peak,5,15 70 250 125
  text Unique: %nr.uni,6,15 85 250 125
  button "Say!", 7,111 115 60 24
} 

on *:dialog:rankstats:sclick:*: { 
  if ($did == 7) { 
    if ($active != #YOUR-RADIO-CHANNEL) {
      /msg $active 4(Radio Stats) Listeners: %nr.listen 14( $+ %nr.peak top $+ , %nr.max max $+ , %nr.uni unique) 7Song: %nr.song 14(@ %nr.kbps $+ kbps)
    }    
  }
}

on *:sockopen:nr.song: {
  sockwrite -n $sockname GET /7.html HTTP/1.0
  sockwrite -n $sockname User-Agent: SHOUTcast Song Status (Mozilla  Compatible)
  sockwrite -n $sockname Host: 217.121.86.2:8001
  sockwrite -n $sockname Connection: keep-alive
  sockwrite -n $sockname $crlf
}
on *:sockread:nr.song: { 
  sockread -fn &bin 
  var %nr.fullline = $bvar(&bin,108,400).text 
  set %nr.serverStatus $gettok(%nr.fullline,2,44) 
  set %nr.kbps $gettok(%nr.fullline,6,44) 
  set %nr.listen $gettok(%nr.fullline,5,44) 
  set %nr.max $gettok(%nr.fullline,4,44) 
  set %nr.song $gettok(%nr.fullline,7,44) 
  set %nr.song $gettok(%nr.song,1,60) 
  set %nr.peak $gettok(%nr.fullline,3,44)
  set %nr.uni $gettok(%nr.fullline,1,44)
  sockclose nr.song 
  halt
}
else {
  set %nr.song No stream was found!
}
sockclose nr.song

Comments

Sign in to comment.
miniCruzer   -  Sep 05, 2009

If you're trying to run the script on the same machine as the server, you'll want to use something called AMIP. It won't be as fancy, but it still works. http://amip.tools-for.net/wiki/

Then you can make !request and other scripts that don't use sockets for the server.

 Respond  
Cheiron   -  Jun 15, 2009

indeed so.. you have to stream to a dedicated server like viastreaming.net or streamingchoice.com via your SAM or winamp etc. then enter the servers details .. eg s7.viatreaming.net 7650 on the script. then the socket can pick it up direct from them from the bot that the script is on:)
if you use shoutcast's personal stream that runs on your pc, which is not recommended unless you have a T3 connection. most domestic isps will allow you 1meg max up which on a personal stream will give you at 56kbs roughly 20 people able to connect. not to mention the strain on ram and pc resources

 Respond  
^Neptune   -  Jun 15, 2009

The script needs to be run on a computer NOT hosting the SHOUTcast radio itself - it doesn't work correctly if it's on the same machine (have had experience with this before).

 Respond  
Cheiron   -  Jun 15, 2009

try this one. it is what i am using on my server. mirc used was mirc v6.35, server was unrealircd 3.2.7

on *:TEXT:!on:#channel:if ($nick isop $chan) { enable #playsongpop | .timercheckop 0 10 songp }
on *:TEXT:!off:#channel:if ($nick isop $chan) { disable #playsongpop | .timercheckop off }
on *:TEXT:!playing:#:{ stime $chan }
#playsongpop off
alias -l songp {
  sockopen songp stream details port
  set %kanaal4 $1
}
on *:sockopen:songp: {
  sockwrite -n $sockname GET /7 HTTP/1.0
  sockwrite -n $sockname User-Agent: Mozilla
  sockwrite -n $sockname
}
on *:sockread:songp:{
  var %t
  sockread %t
  while ($sockbr) {
    sockread -f %t
    if ($regex(%t,/<body>(.*?)</body>/)) {
      tokenize 44 $regml(1)
      if (%last != $7-) {
        .msg #channel 12 Current Song playing on your Radio: 4 $7-  
        set %last $7-
      }
    }
  }
}
#playsongpop end
alias -l stime { enable #playsongpop | songp $1 | .timercheckuser 1 10 disable #playsongpop }

commands here are manual announcer (once per song) !playing
to trigger auto announce (ops only triggerable) !on / !off
any issues , let me know as this is a worker on my mirc

 Respond  
RicJames   -  Jun 15, 2009

doesn't work just like pretty much every other shoutcast snippet on here. Doesn't anybody have shoutcast snippet/addon that works properly ?

 Respond  
napa182   -  May 18, 2009

44 = $chr(44) and that is a comma

$gettok(text,N,C)
The C parameter is the ascii value of the character separating the tokens.

so like %var token1,token2,token3

 Respond  
eqrunner   -  May 18, 2009

can anyone explain to me what 44 means?

set %nr.listen $gettok(%nr.fullline,5,44) 

I understand the 5 is grabbing the fifth variable, but what does the 44 represent

 Respond  
Xerrion   -  Mar 15, 2009

Fine script but i see you are using a halt whitch is bad.

 Respond  
napalm`   -  Sep 17, 2008

This is incompletely coded, and completely garbage.

 Respond  
PuNkTuReD   -  Sep 17, 2008

i cant see where your opening the socket or where your upstreaming the files.

 Respond  
Zezuma   -  Sep 28, 2007

Seems like you can\'t find the Stream Title token either, I still haven\'t found it ;p

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.