| View previous topic :: View next topic |
| Author |
Message |
NTHosts Op
Joined: 10 Oct 2005 Posts: 100 Location: UK
|
Posted: Mon Jun 05, 2006 11:20 am Post subject: \n dosnt' work :s |
|
|
Ok i have managed to get this far, most of this script works but on the last function for some reason \n isnt' working, it says the first line and thats it... here's the code..
| Code: |
set url "http://www.lynxfm.info/stream.html"
set djtrigger "!dj"
set tracktrigger "!track"
set listenerstrigger "!listeners"
set alltrigger "!all"
set channel "#LynxFM"
### Current DJ ###
if {![info exists egghttp(version)]} {
putlog "egghttp.tcl was NOT successfully loaded."
putlog "shoutcast.tcl has not been loaded as a result."
} else {
proc current_dj {sock} {
global channel
set headers [egghttp:headers $sock]
set body [egghttp:data $sock]
regexp { <td height="39" valign="top" id="description"><font color="white" face="verdana" size="2">(.*)</font></tr>} $body - dj
puthelp "PRIVMSG $channel :\0032\004The current DJ is: \0034$dj"
}
bind pub -|* $djtrigger top:djtrigger
proc top:djtrigger {nick host hand chan text} {
global url
set sock [egghttp:geturl $url current_dj]
return 1
}
### Current Track ###
proc current_track {sock} {
global channel
set headers [egghttp:headers $sock]
set body1 [egghttp:data $sock]
regexp {<td height="39" valign="top" id="song"><font color="white" face="verdana" size="2">(.*?)</font></td>} $body1 - track
puthelp "PRIVMSG $channel :\0032\004The current Track is: \0034 $track"
}
bind pub -|* $tracktrigger top:tracktrigger
proc top:tracktrigger {nick host hand chan text} {
global url
set sock [egghttp:geturl $url current_track]
return 1
}
### Current Listeners ###
proc current_listeners {sock} {
global channel
set headers [egghttp:headers $sock]
set body2 [egghttp:data $sock]
regexp {<td height="21" valign="top" id="listeners"><font color="white" face="verdana" size="2">(.*?)</font></td>} $body2 - listeners
puthelp "PRIVMSG $channel :\0032\004Current Listeners: \0034 $listeners"
}
bind pub -|* $listenerstrigger top:listenerstrigger
proc top:listenerstrigger {nick host hand chan text} {
global url
set sock [egghttp:geturl $url current_listeners]
return 1
}
### All Stats ###
proc show_all {sock} {
global channel
set headers [egghttp:headers $sock]
set all1 [egghttp:data $sock]
set all2 [egghttp:data $sock]
set all3 [egghttp:data $sock]
regexp { <td height="39" valign="top" id="description"><font color="white" face="verdana" size="2">(.*)</font></tr>} $all1 - dj
regexp {<td height="39" valign="top" id="song"><font color="white" face="verdana" size="2">(.*?)</font></td>} $all2 - track
regexp {<td height="21" valign="top" id="listeners"><font color="white" face="verdana" size="2">(.*?)</font></td>} $all3 - listeners
puthelp "PRIVMSG $channel :\0032\004Current Status:\n \0034 The current DJ is:$dj \n The current track is: $track \n With listeners: $listeners"
}
bind pub -|* $alltrigger top:alltrigger
proc top:alltrigger {nick host hand chan text} {
global url
set sock [egghttp:geturl $url show_all]
return 1
}
putlog "shoutcast.tcl has been successfully loaded."
}
|
Any thoughts ?  _________________ www.NT-Hosts.Net - More than just a host |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Mon Jun 05, 2006 3:18 pm Post subject: |
|
|
split that last puthelp:
| Code: | puthelp "PRIVMSG $channel :\0032\004Current Status:"
puthelp "PRIVMSG $channel :\0034 The current DJ is:$dj"
puthelp "PRIVMSG $channel :The current track is: $track"
puthelp "PRIVMSG $channel :With listeners: $listeners" |
|
|
| Back to top |
|
 |
NTHosts Op
Joined: 10 Oct 2005 Posts: 100 Location: UK
|
Posted: Mon Jun 05, 2006 4:26 pm Post subject: hehe |
|
|
Thanks, works perfect.. I shoulda guessed that myself eh
Oh well another day gone and a little bit more learnt thanks again  _________________ www.NT-Hosts.Net - More than just a host |
|
| Back to top |
|
 |
|