Kod: Kodu kopyalamak için üzerine çift tıklayın!
proc playing {target} {
global streamip streamport streampass dj
putlog "shoutcast: $target asked for current song"
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 streamstatus [string range $bl [shrink + 14 "<STREAMSTATUS>" 0 $bl] [shrink - 1 "</STREAMSTATUS>" 0 $bl]]
set songtitle [string range $bl [shrink + 11 "<SONGTITLE" 0 $bl] [shrink - 1 "</SONGTITLE>" 0 $bl]]
set songurl [string range $bl [shrink + 9 "<SONGURL>" 0 $bl] [shrink - 1 "</SONGURL>" 0 $bl]]
if {$songurl != ""} { set songurl " ($songurl)"}
regsub -all "<" $songtitle "<" songtitle
regsub -all ">" $songtitle ">" songtitle
regsub -all "&" $songtitle "+" songtitle
regsub -all """ $songtitle "\"" songtitle
regsub -all "'" $songtitle "'" songtitle
regsub -all "ÿ" $songtitle "" songtitle
regsub -all "´" $songtitle "´" songtitle
regsub -all "–" $songtitle "-" songtitle
regsub -all "ö" $songtitle "ö" songtitle
regsub -all "ä" $songtitle "ä" songtitle
regsub -all "ü" $songtitle "ü" songtitle
regsub -all "Ö" $songtitle "Ö" songtitle
regsub -all "Ä" $songtitle "Ä" songtitle
regsub -all "Ü" $songtitle "Ü" songtitle
regsub -all "ß" $songtitle "ß" songtitle
if {$streamstatus == 1} {
putserv "notice $target :Suan Calan Sarki : $songtitle$songurl"
} else {
putserv "notice $target :Suan Sarki Calmiyor - Yayinda Dj Bulunmuyor."
}}}
close $sock
}}
bu kodu radyo.tcl bir yerine ekle otomatik atar global.