Vous n'êtes pas identifié(e).
Pages : 1
Hello.
Comme promis, voici le bout de code pour eggdrop qui permet d'afficher les titres, auditeurs, etc...
Je n'ai toujours pas eu le temps de le refaire propre, je vous le donne donc tel quel.
Code: TCL
# Ip de la webradio
set ::webradio(ip) "IP:8000"
# Nom de la Webradio
set ::webradio(name) "Nom de la Webradio"
# Site de la Webradio
set ::webradio(web) "[url]http://www.google.fr[/url]"
# Salon de la Webradio
set ::webradio(salon) "#webradio"
# Salon des administrateurs de la Webradio
set ::webradio(admin) "#webradio.admin"
# Url pour ecouter la Webradio
# Winamp
set ::webradio(winamp) "[url]http://lien.vers.winamp/128.m3u[/url]"
# Windows Media Player
set ::webradio(wmp) "[url]http://lien.vers.wmp/128.wmp[/url]"
# Real Player
set ::webradio(real) "[url]http://lien.vers.realplayer/128.ram[/url]"
package require http
if {![file exists "peak.db"]} { set c_peak [open "peak.db" a+]; close $c_peak }
set ::titre {1,0» Actuellement sur 4Club6Tem.Net1, tu peux écouter:7,0 title_now 1,0« } // A modifier
set ::audi {1,0» Actuellement sur 4Club6Tem.Net1, il y a7,0 listen_now 1,0Auditeur(s) ! « } // A modifier
set ::listen {1,0» Actuellement sur 4Club6Tem.Net1, il y a7,0 listen_now 1,0Auditeur(s) ! « } // A modifier
set ::dj { 1,0» Actuellement sur 4Club6Tem.Net1, le Dj est7 dj_now ! « } // A modifier
set ::djsinit "La Playlist"
proc sockconnect {type server port option} {if {$type=="HTTP"} {if {[catch {set socket [socket $server $port]} error]} {putlog "webradio.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 webradio.TCL Par NiCkOoS";puts $socket "Connection: keep-alive";puts $socket "";flush $socket;return $socket}}
proc nocolor {arg} {regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $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 pub - !audi proc:audi
bind pub - !titre proc:titre
bind pub - !aide proc:aide
bind pub - !site proc:site
bind pub - !web proc:site
bind pub - !url proc:url
bind pub - !dj proc:dj
bind pub o !imdj proc:imdj
bind pub o !nodj proc:nodj
bind time - "* * * * *" isonline
bind time - "?0 * * * *" advertise
if {![info exists ::avant]} { set ::avant "0" }
if {![info exists ::avanttitre]} { set ::avanttitre "" }
if {![info exists ::atitre]} { set ::atitre "" }
proc proc:aide { nick uhost handle chan arg } {
putserv "notice $nick :Les commandes sont:"
putserv "notice $nick !site !web !url !titre !audi !dj"
}
proc isonline { nick uhost hand chan arg } {
set ::nba 0
set ::saudi 0
set url "http://$::webradio(ip)/index.html?sid=1"
::http::config -useragent "Mozilla/5.0; Shoutinfo"
set http_req [::http::geturl $url -timeout 2000]
if {[::http::status $http_req] != "ok"} {
puthelp "PRIVMSG $chan :Stream is unavailable";
}
set data [::http::data $http_req]
::http::cleanup $http_req
if {[regsub -all {.*Stream Status: </font></td><td><font class="default"><b>Stream is up at [0-9]+ kbps with [0-9]+ of [0-9]+ listeners \(([^<]+) unique\)</b>.*} $data {\1} ::saudi]!=0} {
incr ::nba $::saudi
}
set url "http://$::webradio(ip)/currentsong?sid=1"
::http::config -useragent "Mozilla/5.0; Shoutinfo"
set http_req [::http::geturl $url -timeout 2000]
if {[::http::status $http_req] != "ok"} {
puthelp "PRIVMSG $chan :Stream is unavailable";
}
set data [::http::data $http_req]
::http::cleanup $http_req
set ::atitre $data
if {$::avant != $::nba} {
putquick "PRIVMSG $::webradio(salon) :[string map "listen_now {$::nba}" $::listen]"
set ::avant $::nba
}
if {$::avanttitre != $::atitre} {
putquick "PRIVMSG $::webradio(salon) :[string map "title_now {[string map {"\ç" "ç" "»" "\273" "€" "\200" "€" "\200" "é" "é" "<" "<" ">" ">" "&" "&" """ "\"" "à" "à" "è" "è" "ù" "ù" "û" "û" "ê" "ê" "â" "â" "î" "î" "ô" "ô" "ï" "ï"} $data]}" $::titre]"
set ::avanttitre $::atitre
}
}
proc advertise { nick uhost hand chan arg } { putquick "PRIVMSG $::webradio(salon) :1,0» Ecoutez la radio 7$::webradio(web)1,0 «" }
proc proc:site {nick uhost handle chan arg} { putquick "PRIVMSG $chan :1,0 » WebSite : $::webradio(web) 1,0«" }
proc proc:nodj {nick uhost handle chan arg} {
putquick "NOTICE $nick :Plus aucun animateur présent sur l'antenne."
putquick "PRIVMSG $::webradio(salon) :1,0La playlist est de retour !"
putquick "PRIVMSG #::webradio(admin) :\[Dj\] Retour de la playlist"
set ::djs "n/a \{$::djsinit\}"
}
proc proc:imdj {nick uhost handle chan arg} {
putquick "NOTICE $nick :Tu est a présent l'animateur sur l'antenne"
putquick "PRIVMSG $::webradio(salon) :4,0/!\\ Attention /!\\1,0 $nick 7,0prend les platines !"
putquick "PRIVMSG $::webradio(admin) :\[Dj\] Set $nick"
set ::djs "$nick $nick"
}
proc proc:url {nick uhost handle channel arg} {
putquick "PRIVMSG $channel :7,0 » Ecouter 7,0$::webradio(name) 1En LiVe !"
putquick "PRIVMSG $channel :7,0 » (7W1inamp) : $::webradio(winamp) 7«"
putquick "PRIVMSG $channel :4,0 » (R1eal Player) : $::webradio(real) 4«"
putquick "PRIVMSG $channel :7,0 » (7W1indows Media Player) : $::webradio(wmp) 7«"
}
proc proc:titre {nick uhost handle channel arg} {
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 url "http://$::webradio(ip)/currentsong?sid=1"
::http::config -useragent "Mozilla/5.0; Shoutinfo"
set http_req [::http::geturl $url -timeout 2000]
if {[::http::status $http_req] != "ok"} {
puthelp "PRIVMSG $chan :Stream is unavailable";
}
set data [::http::data $http_req]
::http::cleanup $http_req
putquick "PRIVMSG $channel :[string map "title_now {[string map {"\ç" "ç" "»" "\273" "€" "\200" "€" "\200" "é" "é" "<" "<" ">" ">" "&" "&" """ "\"" "à" "à" "è" "è" "ù" "ù" "û" "û" "ê" "ê" "â" "â" "î" "î" "ô" "ô" "ï" "ï"} $data]}" $::titre]"
}
if {![info exists ::djs]} { set ::djs "n/a \{$::djsinit\}" }
proc proc:dj {nick host handle channel arg } { putquick "PRIVMSG $channel :[string map "dj_now {[lindex $::djs 1]}" $::dj]" }
proc proc:audi {nick uhost handle channel arg} {
set ::audi_on 1
#utimer 20 {unset ::audi_on}
set ::nba 0
set url "http://$::webradio(ip)/index.html?sid=1"
::http::config -useragent "Mozilla/5.0; Shoutinfo"
set http_req [::http::geturl $url -timeout 2000]
if {[::http::status $http_req] != "ok"} {
puthelp "PRIVMSG $chan :Stream is unavailable";
}
set data [::http::data $http_req]
::http::cleanup $http_req
if {[regsub -all {.*Stream Status: </font></td><td><font class="default"><b>Stream is up at [0-9]+ kbps with [0-9]+ of [0-9]+ listeners \(([^<]+) unique\)</b>.*} $data {\1} ::saudi]!=0} {
incr ::nba $::saudi
putquick "PRIVMSG $channel :[string map "listen_now {$::nba}" $::audi]"
}
}
proc radio:lance { } {
channel add $::webradio(salon)
channel add $::webradio(admin)
}
radio:lance
Dernière modification par Nickoos (15/12/2011 12:33:38)
Hors ligne
Pages : 1