rendered paste body# Live FeelinG-Station
set radiochans "#FeelinG-Station"
set ip "213.****.59.*****"
set port "10330"
set ident "***"
set pass "*****u"
set titre {15,1» En direct Sur 4FeelinG-Station15, tu peux écouter:7,1 title_now 15,1«}
set audi {0,1» Actuellement sur 4FeelinG-Station0,1, il y a7,1 listen_now 0,1Auditeur(s) ! «}
set listen {0,1» Actuellement sur 4FeelinG-Station0,1, il y a7,1 listen_now 0,1Auditeur(s) ! «}
set dj { 15,1» Sur 4FeelinG-Station15, le Dj est7 dj_now 15Bonne écoute sur www.*******.fr !!!!!!!!!! « }
set djsinit "La Playlist"
# Toutes les Variables/Procs présent dans ce TCL ne doivent pas être modifié
# Write avec Sauvgarde du Fichier Antérieur
proc WRITE {Fichier arg} {set read [READ $Fichier];if {$read!=""&&![string match *n $read]} {set read "$readn"};WRITETO $Fichier $read$arg}
# Write sans Sauvgarde du Fichier Antérieur
proc WRITETO {Fichier arg} {if {![file isdirectory [file dirname $Fichier]]} {file mkdir [file dirname $Fichier]};if {![file writable $Fichier]&&[file exists $Fichier]} {return ""};if {$arg==""} {if {[file exists $Fichier]} {file delete $Fichier};return ""};if {[catch {set File [open $Fichier w]}]} {return ""};puts $File $arg;close $File}
# READ rapide
proc READ {Fichier} {if {![file readable $Fichier]} {return ""};if {[catch {set File [open $Fichier r]}]} {return ""};set read [read $File];close $File;return "$read"}
# Réduction de commande
proc stl {arg} {return [string tolower $arg]};proc stu {arg} {return [string toupper $arg]};proc sti {arg N} {return [string index $arg $N]};proc str {arg Begin End} {return [string range $arg $Begin $End]}
# Socket
proc sockconnect {type server port option} {if {$type=="HTTP"} {if {[catch {set socket [socket $server $port]} error]} {putlog "radio.TCL : Erreur de ConneXion ($error)";return "0"};puts $socket "GET $option HTTP/1.0";puts $socket "Host: $server:$port";puts $socket "User-Agent: Mozilla/4.0 radio.TCL Par kr0nik";puts $socket "Connection: keep-alive";puts $socket "";flush $socket;return $socket}}
# Regsub
proc nocolor {arg} {regsub -all -- {03[0-9]{0,2}(,[0-9]{0,2})?|17|37|02|26|06|07} $arg "" arg;return $arg}
proc nopb {arg} {return [string map {"\" "\\\" "[" "\[" "]" "\]" "{" "\{" "}" "\}" """ "\""} $arg]}
proc nohtml {arg} {regsub -all -- {ç} $arg ç arg;regsub -all -- {»} $arg 273 arg;regsub -all -- {€|€} $arg 200 arg;regsub -all -- {é} $arg é arg;regsub -all -- {<} $arg < arg;regsub -all -- {>} $arg > arg;regsub -all -- {&} $arg & arg;regsub -all -- {"} $arg " arg;regsub -all -- {à} $arg à arg;regsub -all -- {è} $arg è arg;regsub -all -- {ù} $arg ù arg;regsub -all -- {û} $arg û arg;regsub -all -- {ê} $arg ê arg;regsub -all -- {â} $arg â arg;regsub -all -- {î} $arg î arg;regsub -all -- {ô} $arg ô arg;regsub -all -- {ï} $arg ï arg;regsub -all -- {<[^>]+>([^<>]*)} $arg {1 } arg;regsub -all -- {([ ]{1,})| | } $arg { } arg;return [string trim $arg]}
proc accent {arg} {return [encoding convertfrom identity $arg]}
bind msg f dj msg:dj
bind pub - !audi pub:audi
bind pub - !titre pub:titre
bind pub - !aide proc:aide
bind pub - !site pub:site
bind pub - !web pub:site
bind pub - !url pub:url
bind pub - !dedi pub:dedi
bind msg R dedi msg:dedi
bind pub - !dj pub:dj
bind msg - imdj msg:imdj
bind msg - nodj msg:nodj
bind time - "* * * * *" isonline
bind time - "?0 * * * *" advertise
set avant "0"
set avanttitre ""
set atitre ""
proc msg:dedi { nick uhost handle arg } {
global botnick
set commande [lindex $arg 0]
if {$commande == ""} {
putquick "NOTICE $nick :Syntaxe : /msg $botnick dedi read|del"
return 0
}
if {$commande == "read"} {
set num "0"
catch {open "/home/fusion/www/dedi.txt" r} liste
putquick "Notice $nick :Liste des dédicaces :"
while {![eof $liste]} {
gets $liste dedic
if {$dedic != "" } { incr num 1; putquick "NOTICE $nick :[$num] $dedic" }
}
catch {close $liste}
putquick "NOTICE $nick :Fin des dédicaces."
}
if {$commande == "del"} {
set numero [lindex $arg 1]
set stop "0"
if {$numero == ""} { putquick "NOTICE $nick :Aucun numéro de dédicace donné !"; return 0 }
set dedi [open "/home/fusion/www/dedi.txt" r]
set counter 0
set ligne ""
while { ![eof $dedi] } {
set foo [gets $dedi]
incr counter
if { $counter == $numero } { set ligne $foo; set stop "1" }
if { $counter != $numero && $foo!=""} { lappend hs "$foo" }
}
close $dedi
if {$stop=="0"} { return 0 }
if {[info exists hs]} {
set del [open /home/fusion/www/dedi.txt w+]
foreach dedicace $hs { puts $del "$dedicace" }
close $del
} else { set del [open /home/fusion/www/dedi.txt w+]; close $del }
putquick "NOTICE $nick :La dedicace ( $ligne ) a bien été supprimé !"
}
}
proc pub:dedi { nick uhost handle chan arg } {
if {$arg == ""} {
putquick "NOTICE $nick :Syntaxe : !dedi ton message"
return 0
}
putquick "NOTICE $nick :Ta dédicace a bien été noté ! Elle sera prochainement lu par un de nos Animateurs et dites a l'antenne !"
set dedicace "$nick $arg"
set dedi [open "/home/eggdrop/radio/dedi.txt" a]
puts $dedi "$dedicace"
close $dedi
putquick "PRIVMSG #Radio-admin :Nouvelle dédicaces de $nick"
}
proc proc:aide { nick uhost handle chan arg } {
global radio
putquick "notice $nick :Les commandes sont:"
putquick "notice $nick !site !web !url !titre !audi !dj !dedi"
putquick "notice $nick En cas de problème, Contactez Emax"
}
proc isonline { nick uhost hand chan arg } {
global audi ip port audi_on avant listen titre titre_on avanttitre atitre radio
set nba 0
foreach ips $ip {
set saudi 0
set socket [sockconnect HTTP [lindex [split $ips :] 0] [lindex [split $ips :] 1] /]
if {$socket=="0"} {continue}
while {[eof $socket]!="1"} {
set gets [gets $socket]
if {[regsub -all {.*Stream Status: </font></td><td><font class=default><b>Stream is up at [0-9]+ kbps with <B>[0-9]+ of [0-9]+ listeners (([^<]+) unique)</b>.*} $gets {1} saudi]!=0} {
incr nba $saudi
}
}
close $socket
}
set socket2 [sockconnect HTTP [lindex [split [lindex $ip 0] :] 0] [lindex [split [lindex $ip 0] :] 1] /]
if {$socket2=="0"} {return 0}
while {[eof $socket2]!="1"} {
set gets [gets $socket2]
if {[regsub -all {.*Current Song: </font></td><td><font class=default><b>([^<]+)</b>.*} $gets {1} stitre]!=0} {
set atitre "[string map "title_now {[string map {"ç" "ç" "»" "273" "€" "200" "€" "200" "é" "é" "<" "<" ">" ">" "&" "&" """ """ "à" "à" "è" "è" "ù" "ù" "û" "û" "ê" "ê" "â" "â" "î" "î" "ô" "ô" "ï" "ï"} $stitre]}" $titre]"
}
}
close $socket2
if {$avant != $nba} {
putquick "PRIVMSG #FeelinG-Station :[string map "listen_now {$nba}" $listen]"
set avant $nba
}
if {$avanttitre != $atitre} {
putquick "PRIVMSG #FeelinG-Station :[string map "title_now {[string map {"ç" "ç" "»" "273" "€" "200" "€" "200" "é" "é" "<" "<" ">" ">" "&" "&" """ """ "à" "à" "è" "è" "ù" "ù" "û" "û" "ê" "ê" "â" "â" "î" "î" "ô" "ô" "ï" "ï"} $stitre]}" $titre]"
set avanttitre $atitre
}
}
proc advertise { nick uhost hand chan arg } {
global streamip streamport radio
putquick "PRIVMSG #FeelinG-Station :0,115» Ecoutez la radio 4http://fombec.free.fr/feeling-station/0,1 powered by 70,1 feeling-station«"
putquick "PRIVMSG #FeelinG-Station :12N4ouveau! Envoyer vos dedicaces au *** --> DEDI FUSION suivit de votre dédicace ! Elle apparaitra sur le site !(pas encore active)"
}
proc pub:site {nick uhost handle channel arg} {
global radio
putquick "PRIVMSG $channel :15,1 » Allez sur 4FeelinG-Station 15( 7www.FeelinG-Station.org15 ) !!! «"
}
proc msg:nodj {nick uhost handle arg} {
global radio
if {![onchan $nick #Radio-admin]} {return 0}
global djs dj djsinit
putquick "NOTICE $nick K, à plus personne qui live "
putquick "PRIVMSG #FeelinG-Station :0,1La playlist est de retour ! 7,1Enjoy Your HitZ !"
putquick "PRIVMSG OPERSERV :global 0,1La playlist est de retour Sur #FeelinG-Station ! 7,1Enjoy Your HitZ !"
set djs "n/a {$djsinit}"
}
proc msg:imdj {nick uhost handle arg} {
global radio
if {![onchan $nick #Radio-admin]} {return 0}
global djs dj
putquick "NOTICE $nick K, c'est toi qui Mix "
putquick "PRIVMSG #FeelinG-Station :4,1/! Attention /!0,1 $nick 7,1prend les platines !"
putquick "PRIVMSG operserv :global 4,1/! Attention /!0,1 $nick 7,1prend les platines sur #FeelinG-Station ! "
set djs "$handle $nick"
}
proc pub:url {nick uhost handle channel arg } {
global radio
putquick "PRIVMSG $channel :7,1 » 15Ecouter 7FeelinG-StationEn Live !"
putquick "PRIVMSG $channel :7,1 » (7lecteur) : http://fombec.free.fr/feeling-station/7«"
}
proc pub:titre {nick uhost handle channel arg} {
global titre ip port titre_on radio
if {[info exists titre_on]} {foreach timer [utimers] {if {[lindex $timer 1]=="unset titre_on"} {killutimer [lindex $timer 2]}};utimer 20 {unset titre_on};return 0}
set titre_on 1
utimer 20 {unset titre_on}
set socket [sockconnect HTTP [lindex [split [lindex $ip 0] :] 0] [lindex [split [lindex $ip 0] :] 1] /]
if {$socket=="0"} {return 0}
while {[eof $socket]!="1"} {
set gets [gets $socket]
if {[regsub -all {.*Current Song: </font></td><td><font class=default><b>([^<]+)</b>.*} $gets {1} stitre]!=0} {
putquick "PRIVMSG $channel :[string map "title_now {[string map {"ç" "ç" "»" "273" "€" "200" "€" "200" "é" "é" "<" "<" ">" ">" "&" "&" """ """ "à" "à" "è" "è" "ù" "ù" "û" "û" "ê" "ê" "â" "â" "î" "î" "ô" "ô" "ï" "ï"} $stitre]}" $titre]"
}
}
close $socket
}
proc proc:titre2 { } {
global titre ip port titre_on radio
if {[info exists titre_on]} {foreach timer [utimers] {if {[lindex $timer 1]=="unset titre_on"} {killutimer [lindex $timer 2]}};utimer 20 {unset titre_on};return 0}
set titre_on 1
utimer 20 {unset titre_on}
set socket [sockconnect HTTP [lindex [split [lindex $ip 0] :] 0] [lindex [split [lindex $ip 0] :] 1] /]
if {$socket=="0"} {return 0}
while {[eof $socket]!="1"} {
set gets [gets $socket]
if {[regsub -all {.*Current Song: </font></td><td><font class=default><b>([^<]+)</b>.*} $gets {1} stitre]!=0} {
return [string map "title_now {[string map {"ç" "ç" "»" "273" "€" "200" "€" "200" "é" "é" "<" "<" ">" ">" "&" "&" """ """ "à" "à" "è" "è" "ù" "ù" "û" "û" "ê" "ê" "â" "â" "î" "î" "ô" "ô" "ï" "ï"} $stitre]}" $titre]"
}
}
close $socket
}
set djs "n/a {$djsinit}"
proc pub:dj {nick uhost handle channel arg} {
global djs dj radio
putquick "PRIVMSG $channel :[string map "dj_now {[lindex $djs 1]}" $dj]"
}
proc msg:dj {nick uhost handle arg} {
global djs djsinit radio
if {$arg==""||[encpass $arg]!=[getuser $handle PASS]} {putserv "NOTICE $nick :Mauvais mot de pass";return 0}
if {$handle==[lindex $djs 0]} {putserv "NOTICE $nick :Tu n'es plus le Dj. ($djsinit)";set djs "n/a {$djsinit}";return 0}
putquick "NOTICE $nick :Enregistrement effectué : $nick."
set djs "$handle $nick"
}
proc pub:audi {nick uhost handle channel arg} {
global audi ip port audi_on radio
#if {[info exists audi_on]} {foreach timer [utimers] {if {[lindex $timer 1]=="unset audi_on"} {killutimer [lindex $timer 2]}};utimer 20 {unset audi_on};return 0}
set audi_on 1
#utimer 20 {unset audi_on}
set nba 0
foreach ips $ip {
set saudi 0
set socket [sockconnect HTTP [lindex [split $ips :] 0] [lindex [split $ips :] 1] /]
if {$socket=="0"} {continue}
while {[eof $socket]!="1"} {
set gets [gets $socket]
if {[regsub -all {.*Stream Status: </font></td><td><font class=default><b>Stream is up at [0-9]+ kbps with <B>[0-9]+ of [0-9]+ listeners (([^<]+) unique)</b>.*} $gets {1} saudi]!=0} {
incr nba $saudi
}
}
close $socket
}
putquick "PRIVMSG $channel :[string map "listen_now {$nba}" $audi]"
}
putlog "Prog Chargé : radio.tcl par kr0nik, TCL pour FeelinG-Station"