Besoin d'aide pour TCL radionomy
#1
Bonjour à tous,

J'ai trouvé des morceaux de code par-ci par-là pour coder une TCL pour les webradio radionomy.
Mon but est de faire dans le même principe que la TCL shoutcast (avec les commandes !titre !dedi etc).

Pour l'instant la TCL ne fait qu'afficher le nom de la radio + le titre du son + l'auteur quand on lui demande ( !titre )

Voici le code source :

tcl
bind pub - "!titre" radio:titre
 
set url "http://api.radionomy.com/currentsong.cfm?radiouid=6d854cc4-bb57-4339-b09f-2e5290a0bfda&apikey=6d854cc4-bb57-4339-b09f-2e5290a0bfda&type=xml"
 
package require http
proc radio:titre { nick uhost handle chan args } {
   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"
}
 
proc htmlentities_decode { text } {
    regsub -all "&lt;" $text "<" text
    regsub -all "&gt;" $text ">" text
    regsub -all "&amp;" $text "et" text
    regsub -all "&quot;" $text "" text
    regsub -all "&Aacute;" $text "Á" text
    regsub -all "&Acirc;" $text "Â" text
    regsub -all "&Agrave;" $text "À" text
    regsub -all "&Aring;" $text "Å" text
    regsub -all "&Atilde;" $text "Ã" text
    regsub -all "&Auml;" $text "Ä" text
    regsub -all "&Ccedil;" $text "Ç" text
    regsub -all "&Eacute;" $text "É" text
    regsub -all "&Ecirc;" $text "Ê" text
    regsub -all "&Egrave;" $text "È" text
    regsub -all "&Iacute;" $text "Í" text
    regsub -all "&Icirc;" $text "Î" text
    regsub -all "&Igrave;" $text "í" text
    regsub -all "&Iuml;" $text "Ï" text
    regsub -all "&Ntilde;" $text "Ñ" text
    regsub -all "&Oacute;" $text "Ó" text
    regsub -all "&Ocirc;" $text "Ô" text
    regsub -all "&Ograve;" $text "Ò" text
    regsub -all "&Oslash;" $text "Ø" text
    regsub -all "&Otilde;" $text "Õ" text
    regsub -all "&Ouml;" $text "Ö" text
    regsub -all "&Uacute;" $text "Ê" text
    regsub -all "&Ucirc;" $text "Û" text
    regsub -all "&Ugrave;" $text "Ù" text
    regsub -all "&Uuml;" $text "í" text
    regsub -all "&Yacute;" $text "Ý" text
    regsub -all "&aacute;" $text "á" text
    regsub -all "&aelig;" $text "ae" text
    regsub -all "&oelig;" $text "oe" text
    regsub -all "&agrave;" $text "à" text
    regsub -all -nocase "&#xe0;" $text "à" text
    regsub -all "&aring;" $text "å" text
    regsub -all "&atilde;" $text "ã" text
    regsub -all "&auml;" $text "ä" text
    regsub -all "&ccedil;" $text "ç" text
    regsub -all -nocase "&#xe7;" $text "ç" text
    regsub -all "&eacute;" $text "é" text
    regsub -all -nocase "&#xe9;" $text "é" text
    regsub -all "&euml;" $text "ë" text
    regsub -all "&iacute;" $text "í" text
    regsub -all "&egrave;" $text "è" text
    regsub -all -nocase "&#xe8;" $text "è" text
    regsub -all "&igrave;" $text "ì" text
    regsub -all "&iuml;" $text "ï" text
    regsub -all "&ntilde;" $text "ñ" text
    regsub -all "&oacute;" $text "ó" text
    regsub -all "&ocirc;" $text "ô" text
    regsub -all -nocase "&#xf4;" $text "ô" text
    regsub -all "&acirc;" $text "â" text
    regsub -all -nocase "&#xe2;" $text "â" text
    regsub -all "&ecirc;" $text "ê" text
    regsub -all -nocase "&#xea;" $text "ê" text
    regsub -all "&ograve;" $text "ò" text
    regsub -all "&icirc;" $text "î" text
    regsub -all "&otilde;" $text "õ" text
    regsub -all "&ouml;" $text "ö" text
    regsub -all "&uacute;" $text "ú" text
    regsub -all "&ucirc;" $text "û" text
    regsub -all -nocase "&#xfb;" $text "û" text
    regsub -all "&ugrave;" $text "ù" text
    regsub -all -nocase "&#xf9;" $text "ù" text
    regsub -all "&uuml;" $text "ü" text
    regsub -all "&yuml;" $text "ÿ" text
    regsub -all "&AElig;" $text "AE" text
    regsub -all "&OElig;" $text "OE" text
    regsub -all "&reg;" $text "®" text
    regsub -all -nocase "&#xae;" $text "®" text
    regsub -all "&copy;" $text "©" text
    regsub -all -nocase "&#xa9;" $text "©" text
    regsub -all "&trade;" $text "â„¢" text
    regsub -all "&plusmn;" $text "±" text
    regsub -all "&deg;" $text "°" text
    regsub -all "&sup1;" $text "¹" text
    regsub -all "&apos;" $text "¹" text
    regsub -all "&sup2;" $text "²" text
    regsub -all "&sup3;" $text "³" text
    regsub -all "&times;" $text "×" text
    regsub -all "&divide;" $text "÷" text
    regsub -all "&euro;" $text "euro" text
    regsub -all -nocase "&laquo;" $text "\"" text
    regsub -all -nocase "&raquo;" $text "\"" text
    return $text
}



Je n'ai jamais codé de TCL et j'aimerais, pour le moment, modifier celle-ci de sorte que selon le salon où l'on tape !titre , l'eggy donne le titre de la radio adéquate.
Je ne sais pas si je suis très clair donc pour résumer, pour la même TCL :

- Sur #powersong : !titre donne : En cours sur  .::. Powersong-radio .::. : Dreamin¹ - par Youssoupha feat Indila et Skalpovich
- Sur #pouet : !titre donne : En cours sur  .::. Pouet .::. : blabla - par blabla
- Etc etc.

je vois un peu le truc (faire un set des différentes URL, récupérer dans une variable le chan d'où la commande a été lancée et en fonction, putserv sur le bon chan) mais je ne sais pas du tout comment faire.

Si quelqu'un pouvait m'aider, ça serait très sympa.

Cordialement
Répondre Avertir


Messages dans ce sujet
Besoin d'aide pour TCL radionomy - par JulienRoad - 23/05/2012, 15:37

Atteindre :


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