24/05/2012, 09:45
En effet, deux erreurs dans mon code.
tcl
bind pub - "!titre" radio:titre
set radio(#chan1) "6d854cc4-bb57-4339-b09f-2e5290a0bfda"
set radio(#chan2) "6d854cc4-bb57-4339-b09f-2e5290a0bfda"
package require http
proc radio:titre { nick uhost handle chan args } {
if { ![lsearch [string tolower $chan] [array names ::radio]] } { return 0 }
set url [concat "http://api.radionomy.com/currentsong.cfm?radiouid=" $::radio([string tolower $chan]) "&apikey=" $::radio([string tolower $chan]) "&type=xml"]
set page [::http::geturl $url -timeout 3000]
set html [::http::data $page]
regexp -all -- {<title>(.+)?</title>} $html null title
regexp -all -- {<radioname>(.+)?</radioname} $html null radio
regexp -all -- {<artists>(.+)?</artists>} $html null artist
putserv "PRIVMSG $chan :En cours sur \002 .::. [htmlentities_decode $radio] .::. \002: \002[htmlentities_decode $title]\002 par \002[htmlentities_decode $artist]\002"
}