| View previous topic :: View next topic |
| Author |
Message |
rpope904 Voice
Joined: 02 Feb 2008 Posts: 16
|
Posted: Thu Apr 24, 2008 7:21 pm Post subject: Quick question regaurding timers.. |
|
|
I am trying to modify an existing script, right now it requires the command !song to be typed in the channel, I want to change it to just display the current song every 5 minutes.. the code is:
bind pub -|- !song get_shoutcast_song
bind pub -|- !np get_shoutcast_song
proc get_shoutcast_song {nick uhost hand chan arg} {
global url streamch
set streamch [string tolower $streamch]
::http::config -useragent "Mozilla/5.0; Shoutinfo"
if {[string tolower $chan] == "$streamch"} {
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 {[regexp {<font class=default>Current Song: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
puthelp "PRIVMSG $chan :\002Current Song\002: $title"
} else {
puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
get_shoutcast_server $nick $uhost $hand $chan $arg
}
}
}
Any help is appreciated :) |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Apr 24, 2008 7:38 pm Post subject: |
|
|
| Code: | bind time - "?0 *" display:song
bind time - "?5 *" display:song
proc display:song args {
global url streamch
set streamch [string tolower $streamch]
::http::config -useragent "Mozilla/5.0; Shoutinfo"
set http_req [::http::geturl $url -timeout 2000]
if {[::http::status $http_req] != "ok"} {
puthelp "PRIVMSG $streamch :Stream is unavailable";
}
set data [::http::data $http_req]
::http::cleanup $http_req
if {[regexp {<font class=default>Current Song: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
puthelp "PRIVMSG $streamch :\002Current Song\002: $title"
} else {
puthelp "PRIVMSG $streamch :Couldn't receive any information, checking server status..."
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|