Besoin d'aide pour TCL radionomy
#8
Voici ce que j'ai et qui fonctionne parfaitement:
tcl
bind pub - "!titre" radio:titre
 
set radio(#powersong) "6d854cc4-bb57-4339-b09f-2e5290a0bfda"
set radio(#pouet) "6d854cc4-bb57-4339-b09f-2e5290a0bfda"
 
package require http
proc radio:titre { nick uhost handle chan args } {
   if { [lsearch [string tolower $chan] [array names ::radio]] == -1} { return 0 }
   set url "http://api.radionomy.com/currentsong.cfm?"
   append url "radiouid=" $::radio([string tolower $chan]) "&apikey=" $::radio([string tolower $chan]) "&type=xml"
   putlog "url: $url"
   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"
}



Par contre, il y avait une erreur dans le lsearch, est-ce que tu n'obtenais pas l'erreur lorsque tu faisais !titre dans un canal qui n'a pas de radio associée ?
Répondre


Messages dans ce sujet
RE: Besoin d'aide pour TCL radionomy - par CrazyCat - 28/05/2012, 10:57

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté