egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Quick question regaurding timers..

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
rpope904
Voice


Joined: 02 Feb 2008
Posts: 16

PostPosted: Thu Apr 24, 2008 7:21 pm    Post subject: Quick question regaurding timers.. Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Apr 24, 2008 7:38 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber