Enigma Bot — File Browser
EnigmaBotv1.4 / EnigmaBotv1.4 / Enigma versione1_4 / radio.mrc
radio.mrc — 18.89 KB — Download this file
ecco curioso il nuovo addon radio per mirc.
/*
#################################################################################
#################################################################################
## ____ _ ____ ___ _____ ##
## | _ \ | | | __ ) / _ \ |_ _| ##
## | | | | _ | | | _ \ | | | | | | ##
## | |_| | | |_| | | |_) | | |_| | | | ##
## |____/ \___/ |____/ \___/ |_| ##
## ____ _ _ ___ _ _ _____ ____ _ ____ _____ ##
## / ___| | | | | / _ \ | | | | |_ _| / ___| / \ / ___| |_ _| ##
## \___ \ | |_| | | | | | | | | | | | | | / _ \ \___ \ | | ##
## ___) | | _ | | |_| | | |_| | | | | |___ / ___ \ ___) | | | ##
## |____/ |_| |_| \___/ \___/ |_| \____| /_/ \_\ |____/ |_| ##
## by Paradox aka Farfuglio ##
#################################################################################
#################################################################################
############# ATTENZIONE!!! NON MODIFICARE MANUALMENTE QUESTO FILE ##############
################### Per caricare l'addon: /load -rs DjBot.mrc ###################
#################################################################################
[INFO]
ShAddon=DjBot ShoutCast v0.6
ShAutore=by mirc
ShNetwork=irc.mindforge.org
ShHome=http://www.altervista.org
ShCanale=#cazzeggio
ShServer=5.39.69.6
ShPorta=9998
ShBitrate=1
ShUsers=1
ShLogo=$+($chr(2),$chr(3),7,$chr(44),1.:Radio Sound Station:.,$chr(2),$chr(3))
ShModificato=14/06/08
*/
;----------------------
;-- Comandi da Popup --
;----------------------
menu menubar {
-
ShCast
.$iif($timer(ShCast) != $null,$style(1)) Avvia : Avvia.Shcast
.$iif($timer(ShCast) == $null,$style(1)) Stop : Stop.Shcast
.-
.Configura:djbot
-
}
;------------
;-- Eventi --
;------------
on *:start: {
.DjBotTable
}
on *:load: {
.DjBotDefaultSet
echo -sat INFO: $ShRead(INFO,ShAddon) $ShRead(INFO,ShAutore) ...
echo -sat INFO: Caricato con le opzioni di Default ... /DjBot per configurarlo.
echo -sat INFO: Network di $ShRead(INFO,ShLogo) $+ : $ShRead(INFO,ShNetwork) -/- Canale: $ShRead(INFO,ShCanale)
.timerOpenDjBot 1 2 DjBot
.DjBotTable
}
on *:unload: {
if ($timer(ShCast) != $null) .timerShCast off
if ($dialog(DjBot)) .dialog -x DjBot
if ($timer(DjBot)) .timerDjBot off
unset %Shcast* %bitrate.old %CurrentUsers.old %canzone.old %Peak.old %maxSup.old
echo -st INFO: DjBot Scaricato.
}
on *:connect: {
.DjBotAuto
}
on *:disconnect: {
if ($timer(ShCast)) .Stop.Shcast
}
;------------------
;-- Dialog DjBot --
;------------------
alias DjBot if (!$dialog(DjBot)) dialog -md DjBot DjBot
dialog DjBot {
title "DjBot Shoutcast"
size -1 -1 274 282
option pixels notheme
box "Settaggi", 1, 2 2 272 98
text "Nome della Radio:", 2, 8 20 94 16
link "Ip/dns Shoutcast:", 3, 8 38 96 16
text "Porta Shoutcast:", 4, 8 56 96 16
text "Canale(i) IRC:", 5, 8 74 96 16
edit "", 6, 110 18 160 20, autohs limit 100
edit "", 7, 110 36 160 20, autohs
edit "", 8, 110 54 68 20, autohs limit 8
edit "", 9, 110 72 160 20, autohs limit 500
box "Opzioni", 10, 2 100 180 70
check "Attiva alla connessione", 11, 6 117 170 14
check "Attiva msg cambio bitrate", 12, 6 133 170 14
check "Attiva msg numero ascoltatori", 13, 6 150 170 14
button "Attiva", 14, 186 106 86 38
box "Stato (Refresh fra: n/d sec.):", 15, 2 170 272 80
text "[Off]", 16, 8 186 50 16, disable
text "[Online]", 17, 60 186 70 16, disable
text "[Offline]", 18, 140 186 70 16, disable
text "[Errore]", 19, 220 186 70 16, disable
text "---", 20, 8 204 260 24, center
text "Ascoltatori: n/d", 21, 8 230 100 20
text "Peak: n/d", 22, 110 230 80 20
text "Bitrate: n/d kbps", 23, 186 230 100 20
button "History >>", 24, 186 151 86 18, default
box "", 25, 2 248 272 34
link "text", 26, 24 260 240 16
box "...", 27, 278 2 258 280
list 28, 280 18 254 236, hsbar sort
button "Salva History", 29, 290 256 80 20
button "Cancella Lista", 30, 445 256 80 20
menu "File", 110
item "SHOUTcast Administrator", 120, 110
item break, 121, 110
item "Chiudi", 122, 110
menu "Modifica", 130
item "Default .:Radio OpenJoke:.", 140, 130
item break, 141, 130
item "Reset Url Ascoltatori", 142, 130
menu "?", 150
item "Home Page", 160, 150
item break, 169, 150
item "Connetti a OpenJoke", 170, 150
item break, 178, 150
item "LEGGIMI!!!", 179, 150
item break, 180, 150
item "Lista comandi Pub", 181, 150
item break, 182, 150
item "About", 190, 150
}
;-------------------
;-- Eventi dialog --
;-------------------
on *:dialog:DjBot:*:*: {
if ($devent == init) {
did -ra $dname 6 %Shcast.Logo
did -ra $dname 7 %Shcast.Server
did -ra $dname 8 %Shcast.SerPort
did -ra $dname 9 %Shcast.Chan
if (%Shcast.Auto == 1) did -c $dname 11
if (%Shcast.Bitrate == 1) did -c $dname 12
if (%Shcast.Ascoltatori == 1) did -c $dname 13
if ($timer(ShCast) != $null) { did -at $dname 14 Disattiva }
else did -e $dname 16
dialog -t $dname $ShRead(INFO,ShAddon)
did -ra $dname 26 $ShRead(INFO,ShAddon) $ShRead(INFO,ShAutore)
did -ra $dname 20 $iif(%canzone.old,$v1,n/d)
did -ra $dname 21 Ascoltatori: $iif(%CurrentUsers.old >= 0,$v1,n/d)
var %i = $+(%Peak.old,/,%maxSup.old)
did -ra $dname 22 Peak: $iif(%Peak.old >= 0,%i,n/d)
did -ra $dname 23 Bitrate: $iif(%bitrate.old,$v1 $+ kbps,n/d kbps)
.timerDjBot -m 0 100 .refreshleftDjBot
}
if ($devent == Sclick) {
if ($did == 3) {
var %a = $iif(%Shcast.Server.Aud,$v1,%Shcast.Server)
var %d = $input($ShRead(INFO,ShAddon) $crlf $crlf Vuoi settare un Ip/Dns alternativo da mostrare agli utenti per connettersi alla radio? $crlf Attualmente è settato: %a,qdaue,Ip/Dns Ascoltatori)
if (%d) { set %Shcast.Server.Aud %d | echo $color(notice) -a INFO: Ip/Dns ascoltatori Settato a: 12 $+ %d }
else { echo $color(notice) -a INFO: Ip/Dns ascoltatori è rimasto invariato: 12 $+ $iif(%Shcast.Server.Aud,$v1,%Shcast.Server) }
}
if ($did == 11) set %Shcast.Auto $did($dname, 11).state
if ($did == 12) set %Shcast.Bitrate $did($dname, 12).state
if ($did == 13) set %Shcast.Ascoltatori $did($dname, 13).state
if ($did == 14) {
if ($timer(ShCast) != $null) { did -at $dname 14 Attiva | did -e $dname 16 | did -b $dname 17-19 | Stop.Shcast }
else { did -at $dname 14 Disattiva | did -b $dname 16 | Avvia.Shcast }
}
if ($did == 24) .DjBotHistory
if ($did == 26) .run $ShRead(INFO,ShHome)
if ($did == 29) {
var %date = $asctime(dd-mm-yy_HH.nn.ss)
var %d = $input($ShRead(INFO,ShAddon) $crlf $crlf Salvo la lista delle tracce suonate? $crlf $+($scriptdirPlayed,_,%date,.txt),wdauyk15,Reset History)
if (%d == $true) .hsave -i DjBotTable $+($scriptdirPlayed,_,%date,.txt) $+(HISTORY_,%date)
}
if ($did == 30) {
var %d = $input($ShRead(INFO,ShAddon) $crlf $crlf Vuoi veramente eliminare la lista delle tracce suonate?,wdauyk15,Reset History)
if (%d == $true) {
.DjBotTable | did -r $dname 28 | var %lines = $did($dname, 28).lines
.did -ra DjBot 27 $strip(%Shcast.logo) Ha suonato %lines $iif(%lines = 1,Traccia:,Tracce:)
}
}
}
if ($devent == edit) {
if ($did == 6) set %Shcast.logo $did($dname, 6).text
if ($did == 7) set %Shcast.Server $did($dname, 7).text
if ($did == 8) set %Shcast.SerPort $did($dname, 8).text
if ($did == 9) set %Shcast.Chan $did($dname, 9).text
}
if ($devent == menu) {
if ($did = 120) .run $+(http://,%Shcast.Server,)
if ($did = 122) .dialog -x $dname
if ($did = 140) {
var %d = $input($ShRead(INFO,ShAddon) $crlf $crlf Vuoi veramente Settare DjBot ai valori di Default?,wdauyk15,Set Default)
if (%d == $true) .AllSetDefault
}
if ($did == 142) {
var %d = $input($ShRead(INFO,ShAddon) $crlf $crlf Vuoi veramente Resettare l'Url Ascoltatori? $crlf Dopo il reset avrà lo stesso Ip/Dns impostato nel dialog,wdauyk15,Reset Ip/dns Ascoltatori)
if (%d == $true) { unset %Shcast.Server.Aud | echo $color(notice) -a INFO: Ip/Dns resettato a: 12 $+ %Shcast.Server }
}
if ($did == 160) .run $ShRead(INFO,ShHome)
if ($did == 170) {
var %s = $ShRead(INFO,ShNetwork)
var %d = $input($ShRead(INFO,ShAddon) $crlf $crlf Vuoi veramente Connetterti al Network %s $+ ?,wdauyk15,Connetti a %s)
if (%d == $true) .server -m %s 6667
}
if ($did == 179) {
if ($findfile($scriptdir,LEGGIMI.txt,1)) .run $+($scriptdir,LEGGIMI.txt)
else .echo -q $input($ShRead(INFO,ShAddon) $crlf $crlf File $qt(LEGGIMI.txt) non trovato,hdauok5,ERRORE)
}
if ($did == 181) .DjBotCommaList
if ($did == 190) .AboutDjBot
}
if ($devent == close) {
.timerDjBot off
}
}
;----------------
;-- Alias Vari --
;----------------
alias DjBotHistory {
var %d = DjBot
if ($dialog(%d).w > 500) { .dialog -sp %d -1 -1 274 302 | did -at %d 24 History >> | return }
else { .SoundPlayed | .dialog -sp %d -1 -1 537 302 | did -at %d 24 << History | return }
}
alias -l DjBotDefaultSet {
set %Shcast.Chan $ShRead(INFO,ShCanale)
set %Shcast.Server $ShRead(INFO,ShServer)
set %Shcast.SerPort $ShRead(INFO,ShPorta)
set %Shcast.Bitrate $ShRead(INFO,ShBitrate)
set %Shcast.Ascoltatori $ShRead(INFO,ShUsers)
set %Shcast.logo $ShRead(INFO,ShLogo)
}
alias -l AllSetDefault {
var %d = DjBot
.DjBotDefaultSet
did -ra %d 6 %Shcast.Logo
did -ra %d 7 %Shcast.Server
did -ra %d 8 %Shcast.SerPort
did -ra %d 9 %Shcast.Chan
if (%Shcast.Auto == 1) did -c %d 11
if (%Shcast.Bitrate == 1) did -c %d 12
if (%Shcast.Ascoltatori == 1) did -c %d 13
}
alias -l AboutDjBot {
.dialog -i DjBot DjBot
var %a = $input(Addon: $ShRead(INFO,ShAddon) $crlf $&
$+ Ultima Modifica: $ShRead(INFO,ShModificato) $crlf $crlf $&
Autore: $ShRead(INFO,ShAutore) $crlf $&
Network: $ShRead(INFO,ShNetwork) $crlf $&
Canale: $ShRead(INFO,ShCanale) $crlf $&
Home: $ShRead(INFO,ShHome) $crlf $&
,o,$ShRead(INFO,ShAddon),title,text)
if (%a == $true) .dialog -e DjBot DjBot
}
alias -l DjBotCommaList {
.dialog -i DjBot DjBot
var %a = $input(Lista Comandi $qt(Pub) $+ : $crlf $crlf $&
!Radio - Mostra la lista comandi pub. $crlf $&
!url - Mostra l'url al quale connettersi per ascoltare la radio. $crlf $&
!Play - Mostra cosa stà suonando la radio. $crlf $&
!bitrate - Mostra il bitrate dello stream. $crlf $&
!ascoltatori - Mostra il numero di ascoltatori connessi. $crlf $&
!dj - Mostra il dj attuale se settato in precedenza $crlf $&
!djset <Nick> - Setta il dj attuale "comando attivo solo $crlf $&
per operatori" $crlf $&
,o,$ShRead(INFO,ShAddon))
if (%a == $true) .dialog -e DjBot DjBot
}
alias refreshleftDjBot {
if ($dialog(DjBot)) .did -ra DjBot 15 Stato (Refresh fra: $iif($timer(ShCast).secs,$v1,0) sec.):
}
alias -l ShRead {
return $readini($script,$1,$2)
}
alias -l DjBotAuto {
if (%Shcast.Auto == 1) && (!$timer(ShCast)) .Avvia.Shcast
}
alias -l Avvia.Shcast {
echo $color(notice) -seat INFO: $ShRead(INFO,ShAddon) Attivato!
.timerShCast 0 30 .Shcast
.Shcast
}
alias -l Stop.Shcast {
.timerShCast off
echo $color(notice) -seat INFO: $ShRead(INFO,ShAddon) Disattivato!
}
alias -l DjBotUrl {
var %s = $iif(%Shcast.Server.Aud,$v1,%Shcast.Server)
return $+(12http://,%s,%Shcast.)
}
;----------
;-- Sock --
;----------
alias Shcast {
sockclose Shcast
sockopen Shcast %Shcast.Server %Shcast.SerPort
}
ON *:sockopen:Shcast: {
;;; echo $color(notice) -set Info Shcast: Connessione ... Attendere
if ($sockerr) {
if ($dialog(DjBot)) { did -e DjBot 18 | did -b DjBot 17,19 }
if (%canzone.old != Server Offline) {
set -e %canzone.old Server Offline
SayRadio.Chan %Shcast.logo Server Shoutcast Offline!!!
}
sockclose Shcast | halt
}
if ($dialog(DjBot)) { did -e DjBot 17 | did -b DjBot 18,19 }
sockwrite -n $sockname GET /7.html HTTP/1.0
sockwrite -n $sockname Host: $sock($sockname).ip
sockwrite -n $sockname User-Agent: Mozilla/5.0
sockwrite -n $sockname Connection: keep-alive
sockwrite -n $sockname $crlf
}
;;;; Formato: ascoltatori, stato server, picco, utenti massimi supportati dal server, poco prima erano "x" ascoltatori, bitrate, Artista - Canzone
ON *:sockread:Shcast: {
if ($sockerr) {
if ($dialog(DjBot)) { did -e DjBot 19 | did -b DjBot 17,18 }
echo $color(notice) -set INFO: $ShRead(INFO,ShAddon) Errore connessione
halt
}
;;;dialog -t DjBot $ShRead(INFO,ShAddon) $qt($sockbr $+ bit letti)
var %bin
sockread -fn &bin | sockread -f %bin
var %url <HTML><meta http-equiv="Pragma" content="no-cache"></head><body>(.*)</body></html>
if ($regex(%bin,%url)) var %line = $regml(1)
var %CurrentUsers = $gettok(%line,1,44)
var %ServerStatus = $gettok(%line,2,44)
var %Peak = $gettok(%line,3,44)
var %maxSup = $gettok(%line,4,44)
var %pUsers = $gettok(%line,5,44)
var %bitrate = $gettok(%line,6,44)
var %canzone = $gettok(%line,7-,44)
if (%ServerStatus == 1) {
if (%canzone) && (%canzone != %canzone.old) {
set -e %canzone.old %canzone
var %t = $qt($time)
if ($dialog(DjBot)) {
did -ra DjBot 20 %canzone
if ($dialog(DjBot).w > 500) {
did -a DjBot 28 %t %canzone
var %lines = $did(DjBot, 28).lines
.did -ra DjBot 27 $strip(%Shcast.logo) Ha suonato %lines $iif(%lines = 1,Traccia:,Tracce:)
}
}
if ($hget(DjBotTable)) .hadd DjBotTable $calc($hget(DjBotTable, 0).item + 1) %t %canzone
var %msg = %Shcast.logo Adesso in onda:9 $upper(%canzone) 7-/- bitrate: %bitrate $+ kbps $&
4 URL: $DjBotUrl
SayRadio.Chan %msg
}
if (%bitrate != %bitrate.old) {
set -e %bitrate.old %bitrate
if ($dialog(DjBot)) did -ra DjBot 23 Bitrate: $iif(%bitrate.old,$v1 $+ kbps,n/d kbps)
if (%Shcast.Bitrate == 1) {
var %msg2 %Shcast.logo Bitrate Cambiato a %bitrate $+ kbps
SayRadio.Chan %msg2
}
}
if (%CurrentUsers != %CurrentUsers.old) {
set -e %CurrentUsers.old %CurrentUsers
if ($dialog(DjBot)) did -ra DjBot 21 Ascoltatori: %CurrentUsers.old
if (%Shcast.Ascoltatori == 1) {
var %msg3 = %Shcast.logo 11Ci sono ora7 %CurrentUsers 11ascoltatori
SayRadio.Chan %msg3
}
}
if (%maxSup != %maxSup.old) {
set -e %maxSup.old %maxSup
if ($dialog(DjBot)) did -ra DjBot 22 Peak: $+(%Peak.old,/,%maxSup.old)
}
if (%peak != %peak.old) {
set -e %Peak.old %Peak
if ($dialog(DjBot)) did -ra DjBot 22 Peak: $+(%Peak.old,/,%maxSup.old)
}
}
elseif (%ServerStatus == 0) {
if (%canzone.old != Nessuna Sorgente) {
set -e %canzone.old Nessuna Sorgente
SayRadio.Chan %Shcast.logo Nessuna Sorgente ... sveglia dj!!!
if ($dialog(DjBot)) did -ra DjBot 20 Nessuna Sorgente
}
}
}
ON *:sockclose:Shcast: {
;;; echo $color(notice) -sea INFO: $ShRead(INFO,ShAddon) ... Fine raccolta info Shcast.
sockclose $sockname
}
alias -l SayRadio.Chan {
if (%Shcast.Chan == $null) { amsg $1- | return }
if ($chr(44) isin %Shcast.Chan) {
var %x = 1, %z = $numtok(%Shcast.Chan,44), %c
while (%x <= %z) {
%c = $gettok(%Shcast.Chan, %x, 44)
if ($me ison %c) msg %c $iif($chanmode(c,%c),$strip($1-),$1-)
;;;else echo $color(ctcp) -st INFO: $ShRead(INFO,ShAddon) Attenzione... Non mi trovo nel canale %c
inc %x
}
}
else if ($me ison %Shcast.Chan) msg %Shcast.Chan $iif($chanmode(c,%Shcast.Chan),$strip($1-),$1-)
}
;------------------------
;-- Tabella Temporanea --
;------------------------
alias DjBotTable {
If ($Hget(DjBotTable)) { .hfree DjBotTable }
.hmake DjBotTable 100
}
alias -l SoundPlayed {
if (!$dialog(DjBot)) return
did -r DjBot 28
var %z = $hget(DjBotTable, 0).item
.did -ra DjBot 27 $strip(%Shcast.logo) Ha suonato %z $iif(%z = 1,Traccia:,Tracce:)
var %x = 1
while (%x <= %z) {
did -ai DjBot 28 $hget(DjBotTable, %x).data
inc %x
}
}
alias -l allTrigers return !Radio,!url,!play,!bitrate,!ascoltatori,!dj,!djset,!version
;-----------------
;-- Comandi Pub --
;-----------------
on *:TEXT:*:#: {
if (!$istok($allTrigers,$1,44)) return
if (%Shcast.Chan != $null) && (!$istok(%Shcast.Chan,$chan,44)) return
if ($Anti.Flood.Sys($1,$nick,$chan,$network) != 0) return
var %m
if ($1 = !Radio) {
%m = Comandi x la Radio: !url -/- !Play -/- !bitrate -/- !ascoltatori -/- !dj -/- $iif($nick isop $chan,4!djset <Nick> -/-) !version
}
if ($1 = !url) {
%m = Ascolta %Shcast.logo: $DjBotUrl
}
if ($1 == !Play) {
%m = %Shcast.logo Adesso in onda: $upper($iif(%canzone.old != $null,$v1,n/d)) -/- bitrate: $iif(%bitrate.old != $null,$v1,n/d) $+ kbps
}
if ($1 == !bitrate) {
%m = %Shcast.logo Bitrate Corrente: $iif(%bitrate.old != $null,$v1,n/d ) $+ kbps
}
if ($1 == !ascoltatori) {
%m = %Shcast.logo Ascoltatori Correnti: $iif(%CurrentUsers.old != $null,$v1,n/d) -/- Peak: $iif(%peak.old != $null,$v1,n/d)
}
if ($1 == !version) {
%m = %Shcast.logo $ShRead(INFO,ShAddon) $ShRead(INFO,ShAutore)
.notice $nick DOWNLOAD URL: 12 $+ $ShRead(INFO,ShHome)
}
if ($1 == !dj) {
%m = %Shcast.logo Gira i Piatti per voi: $iif(%Shcast.dj != $null,$v1,n/d)
}
if ($1 == !djset) && ($nick isop $chan) {
if ($2) {
if ($len($2-) > 30) { notice $nick ERRORE: troppi caratteri max 30 caratteri. | return }
set %Shcast.dj $2-
%m = %Shcast.logo dj settato: $iif(%Shcast.dj != $null,$v1,n/d)
}
else { notice $nick ERRORE: pochi parametri ... Sintassi: !djset <NICK> es.: !djset djPippo }
}
if (%m) msg $chan $iif($chanmode(c,$chan),$strip(%m),%m)
}
alias -l chanmode { if ($1 isincs $gettok($chan($2).mode,1,32)) return 1 }
;---------------------------------------
;-- Protezione Anti flood Comandi Pub --
;---------------------------------------
alias Anti.Flood.Sys {
var %a = $address($2,2)
inc -u30 %flod [ $+ [ $+($1,_,%a) ] ]
if (%flod [ $+ [ $+($1,_,%a) ] ] == 3) {
.echo $color(info) -st Triger $upper($1) Flood: ricevuto da $2 in $3 su $4 lo ignorerò per 60 secondi.
.notice $2 Triger $upper($1) Flood: sarai ignorato per 60 secondi.
ignore -u60 %a
.halt
}
if (%flod [ $+ [ $+($1,_,%a) ] ] > 3) { halt }
if (%flod [ $+ [ $+($1,_,%a) ] ] < 3) return 0
}
;----------------------
;-- Risposta ai ctcp --
;----------------------
CTCP *:*:*:{
if ($1 == VERSION) && ($Anti.Flood.Sys($1,$nick,$chan,$network) == 0) {
.ctcpreply $nick $1 $strip(%Shcast.logo) $ShRead(INFO,ShAddon) $ShRead(INFO,ShAutore)
echo -ste $nick Mi ha fatto un $1 .
.haltdef
}
}
;---------
;-- EOF --
;---------