# shoutcast.tcl v2.0(Reborn) by andravalid (c)2oo4/05
#
# comments? bugs? ideas? requests? money? beer?
# plz mail me or visit my homepage @ www.azkalix-radio.net
# also check out http://www.azkalix-radio.net
#
# this script is for all the online radio admins out there. it announces serveral
# stuff like the status of your radio, the current song, new listener peaks,
# the current listeners and much much more to the channels you want.
# the users can get infos by public and msg command, too, like the stream url,
# stream stats, the last played songs, the current song, the dj... and much
# more.
# also the bot informs the users about the current dj, whenever he changes or
# a certain command is triggered. the dj name doesnt need to be your nickname,
# so you can also call yourself "goethe mc" even if your irc nickname is
# [gay]michael. the good thing about this is: nobody knows your nickname, so
# you wont get unwanted querys with wishes and greets. the dj can also change
# his nickname and the wish- and greet-feature will still work fine.
# only users with the flag +D can be djs, so make sure to give this flag to
# your djs -> .chattr djnick +D
# the script also changes the topic when your stream goes on or offline and
# sends a public message, which is costumizeable.
# it was tested with shoutcast 1.9.2 on debian linux.
#
# note: make sure youve got a good connection from your shellserver to your
# streamserver - if its the same server then thats very very good. the bot
# checks every minute if something happened, so if the connection is not fast
# the bot will lag like hell or timeout. make sure to change your settings
# for the eggdrop floodprotection.
#
# script history:
# v1.02 - added the .listener command, corrected some typos ;>
# v1.01 - fixed a string i forgot to replace
# v1.0 - first public release
#
# what does what config option mean?
#
# radiochans - the channels the tcl is active in, "" for all, or "#chan1 #chan2"
# streamip - the ip of your radio
# streamport - the port of your radio
# streampass - the admin pass of your radio
#
# scstatstrigger - the trigger for the radio stats
# scplayingtrigger - shows the song the radio is playing now
# sclistenertrigger - shows the current listenercount
# scdjtrigger - shows the current dj name
# scstreamtrigger - shows your stream url -> streamtext
# scsetdjtrigger - sets the current dj name, this doesnt have to be your nickname.
# your nick will be saved too and all wishes and greets will be
# redirected to this nickname. only availavle for ppl with the +D
# flag.
# scwishtrigger - the command which the users can use if they wish a certain song
# scgreettrigger - the command which users can use if the want to greet sb
# sclastsongstrigger - the commands which users can use if they want to see the
# songhistory
# schelptrigger - shows the available commands
#
# announce - shall the bot announce any stuff? 1 for yes, 0 for no
# urltopic - shall the bot change the topic everytime the radio goes on or off?
# tellsongs - shall the bot post the songtitle to the channels everytime a
# new song starts?
# tellusers - shall the bot post the number of current users to the channel
# everytime it changes or a new user maximum is reached?
# tellbitrate - shall the bot announce bitrate changes?
#
# offlinetext - the reason the bot says when the radio goes offline
# offlinetopic - the topic which is set when the radio goes offline
#
# onlinetext - the reason the bot says when the radio goes online
# onlinetopic - the topic which is set when the radio goes online
#
# streamtext - the text with your stream infos
# advertise - shall the bot advertist the advertisetext?
# advertisetext - the text the bot will post once every 10 minutes.
#
# known bugs:
# -numbers in the songhistory are killed, this is a xml sourcecode problem
# -öäü are not shown correctly in the songtitles, because xml replaces each
# of them with the same chars, so i cant fix it :(
#
#
#
# config ##########################
set radiochans ""
set streamip "www.stadiumjakarta.info"
set streamport "1111"
set streampass "azkalixradioadmin"
set scstatstrigger ".stats"
set scstreamtrigger ".stream"
set scplayingtrigger ".playing"
set sclistenertrigger ".listener"
set scdjtrigger ".dj"
set scsetdjtrigger ".setdj"
set scwishtrigger "!request"
set scgreettrigger ".greet"
set sclastsongstrigger ".lastsongs"
set schelptrigger ".help"
set announce "1"
set urltopic "0"
set tellsongs "1"
set tellusers "1"
set tellbitrate "1"
set advertise "1"
set offlinetext "0,2|11aZKaLi4X11RADIO0|00 Radio going offline now due to connection problem 0,2|11aZKaLi4X11RADIO0|0"
set onlinetext "8- Romance, Trance, Dance, R&B, Metal"
set onlinetopic "8Radio is back"
set streamtext "0,2|11aZKaLi4X11RADIO0|08 Listen To AZKALIXFM Radio @ http://azkalix.mambrak-mawur.radio.su:1111/listen.pls Or Open Winamp, Then CTRL + L, And Put URL: http://azkalix.mambrak-mawur.radio.su:1111/listen.pls 0,2|11aZKaLi4X11RADIO0|0"
set advertisetext "0,2|11aZKaLi4X11RADIO0| DJ Hunt 0-0 Bagi Kamu Yang Berminat Menjadi DJ di AZKALIXFM Radio Silahkan kirim Biodata Kamu ke 9gambris@gmail.com0 !! 0|7|0 Syarat: Ada Mic, Koneksi min. Cable (128 kbps), Mp3 Updated. 0- 8DJ Hunt 0,2|11aZKaLi4X11RADIO0|"
# end of config #####################
bind pub - $scstatstrigger pub_scstat
bind msg - $scstatstrigger msg_scstat
bind pub - $scplayingtrigger pub_playing
bind msg - $scplayingtrigger msg_playing
bind pub - $scdjtrigger pub_dj
bind msg - $scdjtrigger msg_dj
bind pub D $scsetdjtrigger pub_setdj
bind msg D $scsetdjtrigger msg_setdj
bind pub - $scwishtrigger pub_wish
bind msg - $scwishtrigger msg_wish
bind pub - $scgreettrigger pub_greet
bind msg - $scgreettrigger msg_greet
bind pub - $scstreamtrigger pub_stream
bind msg - $scstreamtrigger msg_stream
bind pub - $sclastsongstrigger pub_lastsongs
bind msg - $sclastsongstrigger msg_lastsongs
bind pub - $sclistenertrigger pub_listener
bind msg - $sclistenertrigger msg_listener
bind pub - $schelptrigger pub_help
bind msg - $schelptrigger msg_help
bind time - "* * * * *" isonline
bind time - "?0 * * * *" advertise
bind nick D * djnickchange
proc shrink { calc number string start bl} { return [expr [string first "$string" $bl $start] $calc $number] }
proc poststuff { mode text } {
global radiochans
foreach chan [channels] {
if {$radiochans == "" } { putserv "$mode $chan :$text" }
if {$radiochans != "" } {
if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} {putserv "$mode $chan :$text"}
}}}
proc schelp { target } {
global scstatstrigger scstreamtrigger scplayingtrigger scdjtrigger sclastsongstrigger scwishtrigger scgreettrigger sclistenertrigger
putserv "notice $target :the following commands are available:"
putserv "notice $target :$scstatstrigger - $scstreamtrigger - $scplayingtrigger - $scdjtrigger - $sclastsongstrigger - $scwishtrigger - $scgreettrigger - $sclistenertrigger"
putserv "notice $target :AZKALIXRADIO @ DAL.net"
}
proc pub_help {nick uhost hand chan arg} {
global radiochans
if {$radiochans == "" } { schelp $nick }
if {$radiochans != "" } {
if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { schelp $nick}
}}
proc advertise { nick uhost hand chan arg } {
global advertisetext advertise
if {$advertise == "1" } { poststuff privmsg $advertisetext }
}
proc setdj {nickname djnickname } {
if {$djnickname == "" } { set djnickname $nickname }
global streamip streamport streampass
putlog "shoutcast: new dj: $djnickname ($nickname)"
set temp [open "dj" w+]
puts $temp $djnickname
close $temp
set temp [open "djnick" w+]
puts $temp $nickname
close $temp
putserv "privmsg $nickname :your are now dj of AZKALIXRADIO Station"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus [string range $bl [shrink + 14 "" 0 $bl] [shrink - 1 "" 0 $bl]]
}}
if { $streamstatus == "1" } { poststuff privmsg "$djnickname is now rocking the turntables, enjoy." } else {
putserv "privmsg $nickname :this has not been announced because the radio is currentlfy offline." }
}}
proc listener { target } {
global streamip streamport streampass
putlog "shoutcast: $target requested listener count"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set repl [string range $bl [shrink + 19 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set curhigh [string range $bl [shrink + 15 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set maxl [string range $bl [shrink + 14 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set avgtime [string range $bl [shrink + 13 "" 0 $bl] [shrink - 1 "" 0 $bl]]
}}
close $sock
putserv "notice $target :There are currently $repl unique people listening, the listener maximum is $maxl, our user peak was at $curhigh listeners, the listening time average is $avgtime "
}}
proc msg_listener { nick uhost hand arg } { global radiochans; listener $nick }
proc pub_listener { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { listener $nick }}
proc wish { nick arg } {
if {$arg == ""} { putserv "notice $nick :you forgot to add your wish"; return 0}
global streamip streamport streampass
putlog "shoutcast: $nick wants to hear: $arg"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus [string range $bl [shrink + 14 "" 0 $bl] [shrink - 1 "" 0 $bl]]
}}
if { $streamstatus == "1" } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $djnick : 0,2|11aZKaLi4X11RADIO0|7 *** INCOMING *** (REQUEST) From: $nick Content: $arg 0,2|11aZKaLi4X11RADIO0|7 "
putserv "notice $nick : 0,2|11aZKaLi4X11RADIO0|7 Requested » $arg » Sent............... to DJ, Please wait till ur turn (Don't Request This Song Again) 0,2|11aZKaLi4X11RADIO0|7 "
} else {
putserv "notice $nick :sorry AZKALIXRADIO is currently offline" }
}}
proc msg_wish { nick uhost hand arg } { global radiochans; wish $nick $arg }
proc pub_wish { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { wish $nick $arg }}
proc sclastsongs { target } {
global streamip streamport streampass
putlog "shoutcast: $target requested songhistory"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set songs [string range $bl [string first "" $bl] [expr [string last "" $bl] + 7]]
regsub -all "<" $songs "<" songs
regsub -all ">" $songs ">" songs
regsub -all "&" $songs "+" songs
regsub -all """ $songs "\"" songs
regsub -all "'" $songs "'" songs
regsub -all "ÿ" $songs "" songs
regsub -all "" $songs "(" songs
regsub -all "" $songs ")" songs
regsub -all "" $songs "" songs
regsub -all "" $songs " - " songs
regsub -all "" $songs "" songs
regsub -all "" $songs "" songs
regsub -all {\d} $songs "" songs
}}
putserv "notice $target :$songs"
}}
proc msg_lastsongs { nick uhost hand arg } { global radiochans; sclastsongs $nick }
proc pub_lastsongs { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { sclastsongs $nick }}
proc scstream { target } {
global streamip streamport streamtext
putlog "shoutcast: streaminfo requested by $target"
putserv "notice $target :$streamtext"
}
proc msg_stream { nick uhost hand arg } { global radiochans; scstream $nick }
proc pub_stream { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scstream $nick }}
proc scgreet { nick arg } {
if {$arg == ""} { putserv "notice $nick :you forgot to add your greetmessage"; return 0}
global dj streamip streamport streampass
putlog "shoutcast: $nick greets fly out to: $arg"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus [string range $bl [shrink + 14 "" 0 $bl] [shrink - 1 "" 0 $bl]]
}}
if { $streamstatus == "1" } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $djnick :(GREET) - $nick - $arg"
} else {
putserv "notice $nick :sorry radio is currently offline" }
}}
proc msg_greet { nick uhost hand arg } { global radiochans; scgreet $nick $arg }
proc pub_greet { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scgreet $nick $arg }}
proc msg_setdj { nick uhost hand arg } { global radiochans; setdj $nick $arg }
proc pub_setdj { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { setdj $nick $arg }}
proc djnickchange { oldnick uhost hand chan newnick } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
if {$oldnick == $djnick} {
putlog "shoutcast: dj nickchange $oldnick -> $newnick"
set temp [open "djnick" w+]
puts $temp $newnick
close $temp
}}
proc dj { target } {
global streamip streamport streampass
putlog "shoutcast: $target asked for dj info"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus [string range $bl [shrink + 14 "" 0 $bl] [shrink - 1 "" 0 $bl]]
}}
if {$streamstatus == 1} {
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
putserv "notice $target :$dj is at the turntables!"
} else { putserv "notice $target :sorry, no Azkalix dj name available" }
} else {
putserv "notice $target :sorry AZKALIXRADIO is currently offline"
}
close $sock
}}
proc msg_dj { nick uhost hand arg } { global radiochans; dj $nick"}
proc pub_dj { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { dj $nick }}
proc scstat {target} {
global streamip streamport streampass
putlog "shoutcast: $target asked for serverstats"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus [string range $bl [shrink + 14 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set repl [string range $bl [shrink + 19 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set curhigh [string range $bl [shrink + 15 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set currentl [string range $bl [shrink + 18 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set surl [string range $bl [shrink + 11 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set maxl [string range $bl [shrink + 14 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set bitrate [string range $bl [shrink + 9 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set stitle [string range $bl [shrink + 13 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set sgenre [string range $bl [shrink + 13 "" 0 $bl] [shrink - 1 "" 0 $bl]]
if {$sgenre != ""} {set sgenre " ($sgenre)"}
set avgtime [string range $bl [shrink + 13 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set irc [string range $bl [shrink + 5 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set icq [string range $bl [shrink + 5 "" 0 $bl] [shrink - 1 "" 0 $bl]]
if {$icq == 0} { set icq "N/A" }
set aim [string range $bl [shrink + 5 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set webhits [string range $bl [shrink + 9 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set streamhits [string range $bl [shrink + 12 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set version [string range $bl [shrink + 9 "" 0 $bl] [shrink - 1 "" 0 $bl]]
if {$streamstatus == 1} {
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
} else { set dj "none" }
putserv "notice $target :$stitle$sgenre is online, running shoutcast $version and streaming at $bitrate kbps, your dj is $dj. please visit http://azkalix.mambrak-mawur.radio.su:1111/listen.pls"
} else {
putserv "notice $target :$stitle$sgenre is currenty offline, running shoutcast $version and streaming at $bitrate kbps, check out $surl" }
putserv "notice $target : 14 There are currently $repl unique people listening, the listener maximum is $maxl, our user peak was at $curhigh listeners. "
putserv "notice $target :the average user is listening $avgtime seconds, our stream had $webhits webhits and $streamhits streamhits."
putserv "notice $target :you can contact the team by andravalid #azkalix irc on #
."
}}
close $sock
}}
proc msg_scstat { nick uhost hand arg } { global radiochans; scstat $nick}
proc pub_scstat { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scstat $nick }}
proc playing {target} {
global streamip streamport streampass
putlog "shoutcast: $target asked for current song"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus [string range $bl [shrink + 14 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set songtitle [string range $bl [shrink + 11 "" 0 $bl]]
set songurl [string range $bl [shrink + 9 "" 0 $bl] [shrink - 1 "" 0 $bl]]
if {$songurl != ""} { set songurl " ($songurl)"}
regsub -all "<" $songtitle "<" songtitle
regsub -all ">" $songtitle ">" songtitle
regsub -all "&" $songtitle "+" songtitle
regsub -all """ $songtitle "\"" songtitle
regsub -all "'" $songtitle "'" songtitle
regsub -all "ÿ" $songtitle "" songtitle
if {$streamstatus == 1} {
putserv "notice $target : 3°=- Now playing $songtitle -=°"
} else {
putserv "notice $target :AZKALIXRADIO Server is currently offline, sorry"
}}}
close $sock
}}
proc msg_playing { nick uhost hand arg } { global radiochans; playing $nick}
proc pub_playing { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { playing $nick }}
proc isonline { nick uhost hand chan arg } {
global radiochans announce tellusers tellsongs tellbitrate urltopic
global offlinetext offlinetopic onlinetext onlinetopic
global streamip streampass streamport
if {$announce == 1 || $tellsongs == 1 || $tellusers == 1 || $tellbitrate == 1} {
set isonlinefile "isonline"
set oldisonline "isonline: 0"
set oldcurlist "curlist: 0"
set oldcurhigh "curhigh: 0"
set oldsong "cursong: 0"
set oldbitrate "bitrate: 0"
if {[file exists $isonlinefile]} {
putlog "shoutcast: checking if stream is online"
set temp [open "isonline" r]
while {[eof $temp] != 1} {
set zeile [gets $temp]
if {[string first "isonline:" $zeile] != -1 } { set oldisonline $zeile }
if {[string first "curlist:" $zeile] != -1 } { set oldcurlist $zeile }
if {[string first "curhigh:" $zeile] != -1 } { set oldcurhigh $zeile }
if {[string first "cursong:" $zeile] != -1 } { set oldsong $zeile }
if {[string first "bitrate:" $zeile] != -1 } { set oldbitrate $zeile }
}
close $temp
}
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0} else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus "isonline: [string range $bl [shrink + 14 "" 0 $bl] [shrink - 1 "" 0 $bl]]"
set repl "curlist: [string range $bl [shrink + 19 "" 0 $bl] [shrink - 1 "" 0 $bl]]"
set curhigh "curhigh: [string range $bl [shrink + 15 "" 0 $bl] [shrink - 1 "" 0 $bl]]"
set currentl [string range $bl [shrink + 18 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set surl "serverurl: [string range $bl [shrink + 11 "" 0 $bl] [shrink - 1 "" 0 $bl]]"
set cursong "cursong: [string range $bl [shrink + 11 "" 0 $bl]]"
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ set songurl [string range $bl [shrink + 9 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set bitrate "bitrate: [string range $bl [shrink + 9 "" 0 $bl] [shrink - 1 "" 0 $bl]]"
set stitle [string range $bl [shrink + 13 "" 0 $bl] [shrink - 1 "" 0 $bl]]
set sgenre [string range $bl [shrink + 13 "" 0 $bl] [shrink - 1 "" 0 $bl]]
}}
close $sock
}
set temp [open "isonline" w+]
puts $temp "$streamstatus\n$repl\n$curhigh\n$cursong\n$bitrate"
close $temp
if {$announce == 1 } {
if {$streamstatus == "isonline: 0" && $oldisonline == "isonline: 1"} {
poststuff privmsg $offlinetext
if {$urltopic == 1} { poststuff topic $offlinetopic }
}
if {$streamstatus == "isonline: 1" && $oldisonline == "isonline: 0" } {
if {$sgenre != ""} {
set sgenre " ($sgenre)"
}
poststuff privmsg " 15,4 0,7 AZKALIXRADIO 15,4 0,2 $stitle$sgenre now online @ 8,2 http://azkalix.mambrak-mawur.radio.su:1111/listen.pls 7,2 with [lindex $bitrate 1]kbits - 8,2Romance, 9,2 Trance, 11,2 Dance, 8,2 R&B, 0,2 Oldies, 9,2 Pop, 10,2 Rock 15,4 0,7 AZKALIXRADIO 15,4 "
if {$urltopic == 1} { poststuff topic "$stitle @ [lindex $surl 1] streaming at [lindex $bitrate 1]kbits $onlinetopic" }
}}
if {($tellusers == 1) && ($streamstatus == "isonline: 1") && ($oldcurhigh != "curhigh: 0") } {
if {$oldcurhigh != $curhigh} {
poststuff privmsg "New Listener Peak: [lindex $curhigh 1]"
}
if {$oldcurlist != $repl} {
poststuff privmsg " 15,4 0,7 AZKALIXRADIO 15,4 11,2 Current AZKALIXRADIO Listeners : [lindex $repl 1] ($currentl) people listening 15,4 0,7 AZKALIXRADIO 15,4 "
}}
if {($tellsongs == 1) && ($oldsong != $cursong) && ($streamstatus == "isonline: 1") } {
if {$songurl != ""} { set songurl " ($songurl)"}
regsub -all "<" $cursong "<" cursong
regsub -all ">" $cursong ">" cursong
regsub -all "&" $cursong "+" cursong
regsub -all """ $cursong "\"" cursong
regsub -all "ÿ" $cursong "" cursong
poststuff privmsg " 15,4 0,7 AZKALIXRADIO 15,4 8,2 Now Playing: [lrange $cursong 1 [llength $cursong]] .: $stitle :. 0,2 Request? Type !request artist - song name .: 9,2 $sgenre :. 11,2 http://azkalix.mambrak-mawur.radio.su:1111/listen.pls 8,2.: Streaming at [lindex $bitrate 1]kbits 15,4 0,7 AZKALIXRADIO 15,4 "
}
if {($tellbitrate == 1) && ($oldbitrate != $bitrate) && ($streamstatus == "isonline: 1") && ($oldbitrate != "bitrate: 0")} {
poststuff privmsg "bitrate switched to [lindex $bitrate 1]kbps"
}}}
putlog "*** shoutcast.tcl v2.0(Reborn) by andravalid succesfully loaded. Rock It Now."