Advertisement
Guest User

radiotcl

a guest
Nov 23rd, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. bind pub - "!titre" radio:titre
  2.  
  3. set radio(#GlobalIRC) "de7d8db6-8ee6-451c-b61d-2d4ac8427864"
  4. set radio(#ItalianRadioPS) "de7d8db6-8ee6-451c-b61d-2d4ac8427864"
  5.  
  6. package require http
  7. proc radio:titre { nick uhost handle chan args } {
  8. if { [lsearch [string tolower $chan] [array names ::radio]] == -1} { return 0 }
  9. set url "http://api.radionomy.com/currentsong.cfm?"
  10. append url "radiouid=" $::radio([string tolower $chan]) "&apikey=" $::radio([string tolower $chan]) "&type=xml"
  11. putlog "url: $url"
  12. set page [::http::geturl $url -timeout 3000]
  13. set html [::http::data $page]
  14. regexp -all -- {<title>(.+)?</title>} $html null title
  15. regexp -all -- {<radioname>(.+)?</radioname} $html null radio
  16. regexp -all -- {<artists>(.+)?</artists>} $html null artist
  17. putserv "PRIVMSG $chan :En cours sur \002 .::. [htmlentities_decode $radio] .::. \002: \002[htmlentities_decode $title]\002 par \002[htmlentities_decode $artist]\002"
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement