mIRC ShoutCast Radio Script, Help! - 19/07/22 12:45 AM
I'd like to see if anyone can help me get this mIRC script for the radio bot going...
I found this somewhere, I couldn't remember where exactly, forgive me. I tried to paste it on my remotes and edited it with our channel's radio stream SHOUTcast settings but I can't get it to work. I am also getting line /sockwrite: 'sc' not connected (line 253, radio.mrc)
thank you!!
I found this somewhere, I couldn't remember where exactly, forgive me. I tried to paste it on my remotes and edited it with our channel's radio stream SHOUTcast settings but I can't get it to work. I am also getting line /sockwrite: 'sc' not connected (line 253, radio.mrc)
Code
; This script allows for a simple SHOUTcast stream management bot to reside in your channel while announcing current ; playing songs. ; Sourced this somewhere I couldn't remember anymore where but line 253 is getting an error ; Script seems to no longer be working but perhaps can be worked out... =============================== Configure: Set the variables under the "Configuration" section, then restart mIRC and the bot will do the rest. :) It includes: Auto announce (for songs on the Shoutcast stream) Manage topic (changes topic when DJ changes) Auto-connect / identify (Anope; NickServ) ================================= Commands (anyone can use): !DJ - messages user current DJ !song - messages user current song !tune/!URL/!listen - messages using the link to the stream !listeners - messages the user with the current listener amount ================================= This code is released under the public domain. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; CONFIGURATION ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias sc_cfg { ; website URL set %stream.site STREAM_SITE_HERE ; stream url (without http:// or trailing slash) set %stream.url STREAM_URL_HERE ; radio stations name set %stream.name RADIO_NAME ; port that the server runs on set %stream.port 0000 ; admin username (usually admin) set %stream.user admin ; admin password set %stream.adpass STREAM_ADMIN_PASSWORD ; dj password set %stream.djpass DJ_PASSWORD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; manage topic (1 is on, 0 is off) set %cfg.top 1 ; announce new song (1 is on, 0 is off) set %cfg.ann 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; bots nick set %irc.nick BOT_NICK ; bots alt nick set %irc.anick BOT_NICK1` ; bots username set %irc.user BOT_USERNAME ; bots realname set %irc.name BOT_REAL_NAME_HERE ; irc server set %irc.server IRC.SERVER.HERE ; irc port (prepend + for SSL servers) set %irc.port 6667 ; irc channel set %irc.chan #RADIO_CHANNEL ; NickServ password set %irc.pass _none_ } ; channel topic format alias sc.topic { return %stream.name $chr(124) Current DJ: $iif(%sc.status == 1,%sc.dj,None) $chr(124) %stream.site } ; song announce format alias sc.ann { return %sc.dj is playing %sc.song } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; ON FUNCTIONS ;; ;; ;; ;;;;;;;;;;;;;;;;;;;; on *:start: { ; set variables sc_cfg ; connect to server server %irc.server %irc.port -i %irc.nick %irc.anick %irc.user %irc.name } on *:notice:*This nickname is registered and protected.*:*: { .msg NickServ IDENTIFY %irc.pass } on *:notice:*Password accepted - you are now recognized.*:*: { .join %irc.chan } on *:join:%irc.chan: { $iif($nick == $me, .timercon 0 10 sc_con) } on *:disconnect: { .timers off } on *:kick:%irc.chan: { $iif($knick == $me, timers off) } on *:part:%irc.chan: { $iif($nick == $me, timers off) } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; SC COMMANDS ;; ;; ;; ;;;;;;;;;;;;;;;;;;; ; connect to shoutcast server alias sc_con { if ($sock(sc).to == $null) { sockopen sc %stream.url %stream.port } elseif ($sock(sc).to > 8) { sockclose sc | sockopen sc %stream.url %stream.port } } ; kick dj alias sc_kick { sockopen sckick %stream.url %stream.port } ; topic change alias sc_topic { if (%cfg.top == 1) { topic %irc.chan $sc.topic } } ; song announce alias sc_msg { if (%cfg.ann == 1) { msg %irc.chan $sc.ann } } ; send error message to user alias sc_errmsg { if ($1 == op) { msg $2 You must have @ (operator) status to use this. } if ($1 == offline) { msg $2 The stream is currently offline. } } ; filters characters back from html ascii codes alias sc_filter { return $replace($1-, & $+ $chr(59), $chr(38), ' $+ $chr(59), $chr(39)) } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; @OP TRIGGERS ;; ;; ;; ;;;;;;;;;;;;;;;;;;;; ; !cycle: bot /cycles in channel on *:text:!cycle:%irc.chan: { if ($nick isop %irc.chan) { hop %irc.chan } else { sc_errmsg op $nick } } ; !info: sends the required dj information on *:text:!info:%irc.chan: { if ($nick isop %irc.chan) { msg $nick host: %stream.url port: %stream.port pass: %stream.djpass msg $nick description: %stream.name url: %stream.site aim: Use your DJ name irc: %irc.chan } else { sc_errmsg op $nick } } ; !kickdj: kicks current dj on *:text:!kickdj:%irc.chan: { if ($nick isop %irc.chan) { sc_kick | msg %irc.chan Kicking current DJ.. } else { sc_errmsg op $nick } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; USER TRIGGERS ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;; ; !dj: sends active dj on *:text:!dj:%irc.chan: { if (%sc.status == 1) { msg $nick Current DJ: %sc.dj } else { sc_errmsg offline $nick } } ; !song: sends the current song on *:text:!song:%irc.chan: { if (%sc.status == 1) { msg $nick Playing: %sc.song } else { sc_errmsg offline $nick } } on *:text:!listeners:%irc.chan: { if (%sc.status == 1) { msg $nick Listeners: %sc.clisten $+ / $+ %sc.mlisten ( $+ %sc.dj $+ ) } else { errmsg offline $nick } } on *:text:!tune:%irc.chan: { msg $nick Tune in at: http:// $+ %stream.url $+ : $+ %stream.port $+ /listen.pls } on *:text:!url:%irc.chan: { msg $nick Tune in at: http:// $+ %stream.url $+ : $+ %stream.port $+ /listen.pls } on *:text:!listen:%irc.chan: { msg $nick Tune in at: http:// $+ %stream.url $+ : $+ %stream.port $+ /listen.pls } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; KICK SOCKETS ;; ;; ;; ;;;;;;;;;;;;;;;;;;;; on *:sockopen:sckick: { sockwrite -nt sckick GET /admin.cgi?mode=kicksrc HTTP/1.0 sockwrite -nt sckick User-Agent: Mozilla/5.0 sockwrite -nt sckick Accept: text/xml,application/xml,application/xhtml+xml,text/html sockwrite -nt sckick Authorization: Basic $encode(%stream.user $+ : $+ %stream.adpass, m) sockwrite -nt sckick $crlf } on *:sockread:sckick: { sockread -fn %tmp if (HTTP/1.0 302 Found isin %tmp) { msg %irc.chan ..DJ was successfully kicked. } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; XML SOCKETS ;; ;; ;; ;;;;;;;;;;;;;;;;;;; on *:sockopen:sc: { sockwrite -nt sc GET /admin.cgi?mode=viewxml HTTP/1.0 ;I GET AN ERROR ON THIS LINE sockwrite -nt sc User-Agent: Mozilla/5.0 sockwrite -nt sc Accept: text/xml,application/xml,application/xhtml+xml,text/html sockwrite -nt sc Authorization: Basic $encode(%stream.user $+ : $+ %stream.adpass, m) sockwrite -nt sc $crlf } on *:sockread:sc: { sockread -fn %xml ; assign variable in proper order, halt reading, scan info, relay, garbage collection! if (<?xml isin %xml) { set %a $mid(%xml,2033,$len(%xml)) } elseif (> isin %xml) { set %a %a $+ %xml } if (</SHOUTCASTSERVER> isin %a) { HALTDEF unset %xml ; dj var %z $sc_filter($left($gettok($replace(%a, <AIM>, $chr(189), </AIM>, $chr(189)),2,189),$len($gettok($replace(%a, <AIM>, $chr(189), </AIM>, $chr(189)),2,189)))) if (%z != %sc.dj) && (%sc.dj) { set %sc.dj %z | sc_topic } else { set %sc.dj %z } ; status var %z $gettok($replace(%a, <STREAMSTATUS>, $chr(189), </STREAMSTATUS>, $chr(189)),2,189) if (%z != %sc.status) && (%sc.status) { set %sc.status %z | sc_topic } else { set %sc.status %z } ; current listeners var %z $gettok($replace(%a, <CURRENTLISTENERS>, $chr(189), </CURRENTLISTENERS>, $chr(189)),2,189) set %sc.clisten %z ; peak listeners var %z $gettok($replace(%a, <PEAKLISTENERS>, $chr(189), </PEAKLISTENERS>, $chr(189)),2,189) set %sc.plisten %z ; max listeners var %z $gettok($replace(%a, <MAXLISTENERS>, $chr(189), </MAXLISTENERS>, $chr(189)),2,189) set %sc.mlisten %z ; genre var %z $gettok($replace(%a, <SERVERGENRE>, $chr(189), </SERVERGENRE>, $chr(189)),2,189) set %sc.genre %z ; song title var %z $sc_filter($left($gettok($replace(%a, <SONGTITLE>, $chr(189), </SONGTITLE>, $chr(189)),2,189),$len($gettok($replace(%a, <SONGTITLE>, $chr(189), </SONGTITLE>, $chr(189)),2,189)))) if (%z != %sc.song) { set %sc.song %z | sc_msg } unset %a } }
thank you!!