i'm having some problems with the shoutcast.tcl script from domsen (shoutcast.tcl v1.03 by domsen <domsen@domsen.org>). His website is offline, and e-mails are not getting through, so asking the author is not possible.
My problems arrise with the !latest trigger, it collects the latest songs data from Shoutcast XML, and everything seems to be working, but the bot will not display the information on the channel.
When i did putlog "$songs" i can see data (artist - song) from 17 of the 20 songs in total, and the 17th song cuts off in the middle, it seems as if a variable can hold x amount of data or characters?
The code:
Code: Select all
proc sclastsongs { target } {
global streamip streamport streampass
putlog "shoutcast: $target requested songhistory"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set songs [string range $bl [string first "<TITLE>" $bl] [expr [string last "</TITLE>" $bl] + 7]]
regsub -all "<" $songs "<" songs
regsub -all ">" $songs ">" songs
regsub -all "&" $songs "+" songs
regsub -all """ $songs "\"" songs
regsub -all "'" $songs "'" songs
regsub -all "ÿ" $songs "" songs
regsub -all "<TITLE>" $songs "(" songs
regsub -all "</TITLE>" $songs ")" songs
regsub -all "<SONG>" $songs "" songs
regsub -all "</SONG>" $songs " - " songs
regsub -all "<PLAYEDAT>" $songs "" songs
regsub -all "</PLAYEDAT>" $songs "" songs
regsub -all {\d} $songs "" songs
regsub -all "´" $songs "´" songs
regsub -all "–" $songs "-" songs
regsub -all "ö" $songs "ö" songs
regsub -all "ä" $songs "ä" songs
regsub -all "ü" $songs "ü" songs
regsub -all "Ö" $songs "Ö" songs
regsub -all "Ä" $songs "Ä" songs
regsub -all "Ü" $songs "Ü" songs
regsub -all "ß" $songs "ß" songs
}}
close $sock
putserv "notice $target :$songs"
}}
[EDIT]
i kind of fixed it myself, i read somewhere you can only output 400 characters or something like that, so i've [string range] the song variable and it works now.