Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ON *:JOIN:%radio_chan: { if ($nick == $me) { set %radio 1 | radio_start } }
- ON *:PART:%radio_chan: { if ($nick == $me) { radio_stop } }
- ON *:KICK:%radio_chan: { if ($knick == $me) { radio_stop } }
- ON *:TEXT:!*:#: {
- tokenize 32 $strip($1-)
- if ($1 == !radiohost) || ($1 == !radioip) {
- if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
- if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify a host/ip! | return }
- if (*:* iswm $2) { .msg $chan ( $+ $nick $+ ): Error, Please specify only an host/ip address without the port! | return }
- if ($2 == %radio_ip) { .msg $chan ( $+ $nick $+ ): Error, Already the same, Please specify an other value! | return }
- set %radio_chan $chan
- set %radio_ip $2
- .msg $chan ( $+ $nick $+ ): The ShoutCast Radio host/ip has been set successfully.
- radio_start
- }
- if ($1 == !radioport) {
- if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
- if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify an port! | return }
- if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify valid port! | return }
- if ($2 == %radio_port) { .msg $chan ( $+ $nick $+ ): Error, Already the same, Please specify an other value! | return }
- set %radio_chan $chan
- set %radio_port $2
- .msg $chan ( $+ $nick $+ ): The ShoutCast Radio port has been set successfully.
- radio_start
- }
- if ($1 == !radiostart) {
- if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
- if (%radio) { .msg $chan ( $+ $nick $+ ): Error, Already running! | return }
- set %radio 1
- set %radio_chan $chan
- .msg $chan ( $+ $nick $+ ): The ShoutCast Radio auto announce has been started.
- radio_start
- }
- if ($1 == !radiostop) {
- if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
- if (!%radio) { .msg $chan ( $+ $nick $+ ): Error, Not running! | return }
- set %radio_chan $chan
- unset %radio
- .msg $chan ( $+ $nick $+ ): The ShoutCast Radio auto announce has been stopped.
- radio_stop
- }
- if ($1 == !song) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %song = $hget(RADIO,SONG)
- .msg $chan ( $+ $nick $+ ): Now Playing - $+ $iif(%song,$v1,N/A) $+
- }
- if ($1 == !radiostatus) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! - (Radio IP: $+ $iif(%radio_ip,$v1,N/A) $+ ) - (Radio Port: $+ $iif(%radio_port,$v1,N/A) $+ ) }
- elseif (%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently online. - (Radio IP: $+ $iif(%radio_ip,$v1,N/A) $+ ) - (Radio Port: $+ $iif(%radio_port,$v1,N/A) $+ ) }
- }
- if ($1 == !listeners) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %max_l = $iif($hget(RADIO,MAXLISTENERS),$v1,0)
- var %listeners = $iif($hget(RADIO,LISTENERS),$v1,0)
- .msg $chan ( $+ $nick $+ ): Listener(s) - $+ %listeners $+ / $+ %max_l $+
- }
- if ($1 == !peak) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %peak = $hget(RADIO,PEAK)
- if (!%peak) { .msg $chan ( $+ $nick $+ ): There is NOT any peak made yet! }
- elseif (%peak) { .msg $chan ( $+ $nick $+ ): Peak Listener(s) - $+ %peak $+ }
- }
- if ($1 == !dj) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %dj = $hget(RADIO,DJ)
- if (!%dj) { .msg $chan ( $+ $nick $+ ): There is NOT any DJ yet on the descs! }
- elseif (%dj) { .msg $chan ( $+ $nick $+ ): Currently DJ - $+ %dj $+ }
- }
- if ($1 == !radiouptime) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %uptime = $hget(RADIO,UPTIME)
- if (!%uptime) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is NOT online! }
- elseif (%uptime) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio uptime is: $+ $duration(%uptime) $+ }
- }
- if ($1 == !bitrate) || ($1 == !bits) || ($1 == !bitrates) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %bits = $hget(RADIO,BITRATE)
- if (!%bits) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is NOT online! }
- elseif (%bits) { .msg $chan ( $+ $nick $+ ): Radio Bitrate - $+ %bits $+ kbps $+ }
- }
- if ($1 == !listen) {
- if (!%radio_ip) { .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio does not has an IP/Host set! | return }
- if (!%radio_port) { .msg $chan ( $+ $Nick $+ ): Error, The ShoutCast Radio does NOT has an Port set! | return }
- .msg $chan ( $+ $nick $+ ): Listen us now from - $+ http:// $+ %radio_ip $+ : $+ %radio_port $+ /listen.pls $+
- }
- if ($1 == !info) || ($1 == !np) || ($1 == !stats) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %dj = $iif($hget(RADIO,DJ),$v1,N/A)
- var %song = $iif($hget(RADIO,SONG),$v1,N/A)
- var %bits = $iif($hget(RADIO,BITRATE),$v1,0)
- var %max_l = $iif($hget(RADIO,MAXLISTENERS),$v1,0)
- var %listeners = $iif($hget(RADIO,LISTENERS),$v1,0)
- var %genre = $iif($hget(RADIO,GENRE),$v1,N/A)
- var %uptime = $iif($hget(RADIO,UPTIME),$duration($v1),N/A)
- .msg $chan ( $+ $nick $+ ): Now Playing - $+ %song $+ - DJ: $+ %dj $+ - Listener(s): $+ %listeners $+ / $+ %max_l $+ - Genre: $+ %genre $+ - Bitrate: $+ %bits $+ kbps $+ - Stream Uptime: $+ %uptime $+ - Listen us now from: $+ http:// $+ %radio_ip $+ : $+ %radio_port $+ /listen.pls $+
- }
- if ($1 == !radiohelp) { .msg $chan ( $+ $Nick $+ : Radio Commands are: !song - !dj - !peak - !listeners - !bits - !info - !listen - !radiostatus - !radiouptime - !radiostart - !radiostop - !radioip - !radioport }
- }
- alias radio_say {
- if ($status !== connected) { return }
- if (!$1) { return }
- if ($me !ison $1) { return }
- var %old = $hget(RADIO,SONG)
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $1 Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $1 Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { radio_stop | .msg $1 The ShoutCast Radio is currently offline, the auto announce will be now disable! | return }
- var %new = $hget(RADIO,SONG)
- var %dj = $iif($hget(RADIO,DJ),$v1,N/A)
- var %song = $iif($hget(RADIO,SONG),$v1,N/A)
- var %bits = $iif($hget(RADIO,BITRATE),$v1,N/A)
- var %max_l = $iif($hget(RADIO,MAXLISTENERS),$v1,N/A)
- var %listeners = $iif($hget(RADIO,LISTENERS),$v1,N/A)
- var %genre = $iif($hget(RADIO,GENRE),$v1,N/A)
- var %uptime = $iif($hget(RADIO,UPTIME),$duration($v1),N/A)
- if (%old !== %new) { .msg $1 Now Playing - $+ %song $+ - DJ: $+ %dj $+ - Listener(s): $+ %listeners $+ / $+ %max_l $+ - Genre: $+ %genre $+ - Bitrate: $+ %bits $+ kbps $+ - Stream Uptime: $+ %uptime $+ - Listen us now from: $+ http:// $+ %radio_ip $+ : $+ %radio_port $+ /listen.pls $+ }
- }
- alias radio_stop { unset %radio | .timer[RADIO_AUTO] off }
- alias radio_start {
- if ($status !== connected) { return }
- if (!%radio) { return }
- if (!%radio_chan) { return }
- if ($hget(RADIO)) { hfree $v1 }
- .timer[RADIO_AUTO] 0 10 radio_say %radio_chan
- }
- alias get_radio {
- if ($status !== connected) { return }
- if (!%radio_ip) && (!%radio_port) {
- if ($isid) { return 1 }
- return
- }
- var %v = radio_ $+ $ticks $+ $ctime
- var %u = http:// $+ %radio_ip $+ : $+ %radio_port $+ /statistics?json=1&nocache= $+ $ticks
- JSONOpen -du %v %u
- if ($JSONError) {
- if ($isid) { return 2 }
- return
- }
- hadd -m RADIO STATUS $json(%v,streams,0,streamstatus)
- hadd -m RADIO PEAK $json(%v,streams,0,peaklisteners)
- hadd -m RADIO SONG $json(%v,streams,0,songtitle)
- hadd -m RADIO DJ $json(%v,streams,0,dj)
- hadd -m RADIO GENRE $json(%v,streams,0,servergenre)
- hadd -m RADIO UPTIME $json(%v,streams,0,streamuptime)
- hadd -m RADIO BITRATE $json(%v,streams,0,bitrate)
- hadd -m RADIO LISTENERS $json(%v,streams,0,currentlisteners)
- hadd -m RADIO MAXLISTENERS $json(%v,streams,0,maxlisteners)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement