it works and im translating it back to english piece by piece (tried original one but failed to get that working)
But i would like the message trigged by !radio and !song sent as a public message into the room instead of a notice to the user issuing the trigger ive been reading and tried a few things but fail to understand what to do..yeah im a tcl nOOb script below
Code: Select all
# shoutcast.tcl v1.03 by domsen <domsen@domsen.org> (c)2oo5
# shoutcast.nor.tcl v1.03 omskrevet til norsk av DevilWolf <devilwolf@gmail.com> (c)2oo5
# shoutcast.nor.tcl v1.03 translated to norwegian by DevilWolf <devilwolf@gmail.com> (c)2oo5
#
# Takk til domsen for scriptet, har skrevet det om fra engelsk til norsk!
# All regards to domsen
#
# whats this script all about?
# -----------------------------
#
# Skriptet er for alle radioadmins der ute. det reklamerer for
# statusen på radioen din, sang som blit spilt nå, ny lytterrekord,
# og hvor mange lyttere det er akkurat nå, og mye mye mer til kanalene som du har lagt til.
# brukerne kan få info via public og msg kommando, som sender url,
# sender status, siste spilte sanger, nåværende sang, dj... og mye mye mer.
# boten informere også om hvem som er dj, og nå han bytter sang eller når en trigger blir brukt.
# dj navnet trenger ikke vær ditt irc nick,
# så du kan kalle deg selv "goethe mc" fordet om nicket ditt er
# [gay]michael. det som er bra med dette er at: ingen vet ditt nickname, så
# du vil ikke motta uønsket ønsker om sanger eller hilsner. dj'en kan også skifte
# nicket og ønske- og hilsen- vil fortsatt fungere fint.
# bare brukere med +D flag kan være djs, så vær sikker på å gi dette flaget til
# dine djs -> .chattr djnick +D i partyline.
#
# scriptet skifter også topic når sendigen går på eller offline og
# sender en public beskjed, noe som er fullt utskiftbart. prøv det ut selv
# og kanskje det møter dine behov :)
#
# det var testet med shoutcast 1.9.2 på debian linux av domsen.
# har også testet det med shoutcast 1.9.5 på slackware 10.0,
# og det fungerer helt fint
#
# NOTE 1: vær sikker på at du har en rask linje fra din shellserver til din
# streamserver - hvis det er samme server da fungerer det extra fint. boten
# sjkker hver minutt om der er noe som har skjedd, så hvis linjen ikke er rask
# vil boten lagge som faen eller pinge ut.
#
#
# script history:
# ----------------
#
# v1.03 - different variables in the texts/topics possible
# - possibility to unset the dj
# - splitted the scripts chans in 'radiochans' and 'adminchans'
# - 'advertiseonlyifonline'-function
# - more regexes
# - some bugfixes
# v1.02 - added the .listener command, corrected some typos ;>
# v1.01 - fixed a string i forgot to replace
# v1.0 - first public release
#
# hva betyr/gjør configen?
# --------------------------------------
#
# radiochans - kanalene shoutcast.tcl skal være aktivert på, "" for alle, eller "#chan1 #chan2"
# adminchans - the channels the admin commands work in
#
# streamip - ipen til radioen din
# streamport - porten til radioen din
# streampass - admin passordet til radioen din
#
# scstatstrigger - triggeren for radio statsen
# scplayingtrigger - triggeren som viser sangen som du spiller nå
# sclistenertrigger - viser hvor mange lyttere du har akkurat nå
# scdjtrigger - viser hvem som er dj akkurat nå
# scstreamtrigger - viser radio-url -> sendertekst
# scsetdjtrigger - setter dj, dette trenger ikke vær nicket/navnet ditt.
# men for at hilsner og ønsker skal kommer frem til dj så må nicket stemme
# for at dem skal bli sendt til det nicket. virker kun for dem som har .chattr +D
# flag.
# scunsetdjtrigger - fjerner dj, trenger +D for dette
# scwishtrigger - kommandoen som gjør at brukeren kan sende inn ønsker
# scgreettrigger - kommandoen som gjør at brukeren kan sende hilsner
# sclastsongstrigger - kommandoen som gjør at brukeren kan se di siste 10 sangene
# schelptrigger - viser kommandoene som en bruker kan benytte
#
# alertadmin - brukeren som vil få beskjed hvis radioen går ned
# doalertadmin - 1 hvis du vil ha msg når radioen går av/ned, 0 hvis du
# ikke vil dette. dette gjøres via botens notice fordi det er mer
# presist og ikke så plagsomt.
#
# announce - skal boten reklamere? 1 for ja, 0 for nei
# urltopic - skal boten skifte topic for hver gang radioen blir slått av/dj går av?
# tellsongs - skal boten si fra hver gang en ny sang blir spilt?
# tellusers - skal boten si fra hvor mange brukere det er som lytter og når det er en ny lytterrekord?
# tellbitrate - skal boten si fra når bitraten skiftes?
#
# offlinetext - sier fra når radioen går offline
# offlinetopic - topic som blir satt når radioen går offline
#
# onlinetext - sier fra når radioen går online
# onlinetopic - topic som blir satt når radioen går online
#
# streamtext - teksten som viser senderinfo
# advertise - skal boten reklamere det som står i reklameringsteksten?
# advertiseonlyifonline - 1 hvis boten kun skal reklamere når radioen er oppe,
# 0 hvis den skal reklamere hele tiden.
# advertisetext - teksten som boten vil reklamere hvert 10. minutt.
#
#
#
# hvordan setter jeg variabler i forskjellige tekster og overskrifter?
# ----------------------------------------------------------
#
# skriptet vet disse variablene som kan bli brukt i offlinetekst, offlinetopic
# onlinetekst, onlinetopic, sendertekst og reklameringtekst:
#
# /dj/ - nicket til dj
# /sgenre/ - serverens musikktittel
# /stitle/ - sendertittel
# /surl/ - serverens url
# /bitrate/ - nåværende bitrate
# /curlist/ - nåværende lyttere
# /curhigh/ - nåværende lytterrekord
# /cursong/ - sangen som blir spilt nå
# $streamip - ipen til radioen
# $streamport - porten for radioen
#
# config ##########################
set radiochans "#chan1 #chan2"
set adminchans "#achan"
set streamip "some.ip.here"
set streamport "0001"
set streampass "mysecretpassword"
set scstatstrigger "!stats"
set scstreamtrigger "!radio"
set scplayingtrigger "!song"
set sclistenertrigger "!lyttere"
set scdjtrigger "!dj"
set scsetdjtrigger "!setdj"
set scunsetdjtrigger "!unsetdj"
set scwishtrigger "!wish"
set scgreettrigger "!hilsen"
set sclastsongstrigger "!10siste"
set schelptrigger "!hjelp"
set alertadmin "Mrkivi"
set doalertadmin "1"
set announce "1"
set urltopic "0"
set ctodjc "0"
set tellsongs "0"
set tellusers "1"
set tellbitrate "0"
set advertise "1"
set advertiseonlyifonline "1"
set offlinetext "Minions is Working Be Right Back"
set offlinetopic "radio offline"
set onlinetext "/stitle/ now online @ http://$streamip:$streamport/ with /bitrate/kbits"
set onlinetopic "/dj/ @ http://$streamip:$streamport sends at /bitrate/kbits"
set streamtext "Tune in @ http://$streamip:$streamport"
set advertisetext "Tune In @ http://$streamip:$streamport"
# end of config #####################
bind pub - $scstatstrigger pub_scstat
bind msg - $scstatstrigger msg_scstat
bind pub - $scplayingtrigger pub_playing
bind msg - $scplayingtrigger msg_playing
bind pub - $scdjtrigger pub_dj
bind msg - $scdjtrigger msg_dj
bind pub D $scsetdjtrigger pub_setdj
bind msg D $scsetdjtrigger msg_setdj
bind pub D $scunsetdjtrigger pub_unsetdj
bind msg D $scunsetdjtrigger msg_unsetdj
bind pub - $scwishtrigger pub_wish
bind msg - $scwishtrigger msg_wish
bind pub - $scgreettrigger pub_greet
bind msg - $scgreettrigger msg_greet
bind pub - $scstreamtrigger pub_stream
bind msg - $scstreamtrigger msg_stream
bind pub - $sclastsongstrigger pub_lastsongs
bind msg - $sclastsongstrigger msg_lastsongs
bind pub - $sclistenertrigger pub_listener
bind msg - $sclistenertrigger msg_listener
bind pub - $schelptrigger pub_help
bind msg - $schelptrigger msg_help
bind time - "* * * * *" isonline
bind time - "0 * * * *" advertise
bind time - "40 * * * *" advertise
bind nick D * djnickchange
set dj ""
set surl ""
set bitrate ""
set stitle ""
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
}
proc shrink { calc number string start bl} { return [expr [string first "$string" $bl $start] $calc $number] }
proc status { } {
global streamip streamport streampass
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]]
}}
close $sock
}
if { $streamstatus == "1" } { return 1 } else { return 0 }
}
proc poststuff { mode text } {
global radiochans dj
set curlist "0"
set curhigh "0"
set surl ""
set cursong ""
set sgenre ""
set bitrate "0"
set stitle ""
set temp [open "isonline" r]
while {[eof $temp] != 1} {
set zeile [gets $temp]
if {[string first "curlist:" $zeile] != -1 } { set curlist $zeile }
if {[string first "curhigh:" $zeile] != -1 } { set curhigh $zeile }
if {[string first "cursong:" $zeile] != -1 } { set cursong [lrange $zeile 1 [llength $zeile]]] }
if {[string first "sgenre:" $zeile] != -1 } { set sgenre [lrange $zeile 1 [llength $zeile]]}
if {[string first "serverurl:" $zeile] != -1 } { set surl [lindex $zeile 1] }
if {[string first "bitrate:" $zeile] != -1 } { set bitrate [lindex $zeile 1] }
if {[string first "stitle:" $zeile] != -1 } { set stitle [lindex $zeile 1] }
}
close $temp
regsub -all "/stitle/" $text "$stitle" text
regsub -all "/curlist/" $text "$curlist" text
regsub -all "/curhigh/" $text "$curhigh" text
regsub -all "/cursong/" $text "$cursong" text
regsub -all "/sgenre/" $text "$sgenre" text
regsub -all "/surl/" $text "$surl" text
regsub -all "/bitrate/" $text "$bitrate" text
regsub -all "/dj/" $text "$dj" text
foreach chan [channels] {
if {$radiochans == "" } { putserv "$mode $chan :$text" }
if {$radiochans != "" } {
if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1)} {putserv "$mode $chan :$text"}
}}}
proc schelp { target } {
global scstatstrigger scstreamtrigger scplayingtrigger scdjtrigger sclastsongstrigger scwishtrigger scgreettrigger sclistenertrigger
putserv "notice $target :følgene kommandoer er tilgjengelige:"
putserv "notice $target :$scstatstrigger - $scstreamtrigger - $scplayingtrigger - $scdjtrigger - $sclastsongstrigger - $scwishtrigger - $scgreettrigger - $sclistenertrigger"
putserv "notice $target :shoutcast.nor.tcl oversatt av DevilWolf <devilwolf@gmail.com>"
putserv "notice $target :shoutcast.tcl skrevet av domsen <domsen@domsen.org>"
}
proc pub_help {nick uhost hand chan arg} {
global radiochans
if {$radiochans == "" } { schelp $nick }
if {$radiochans != "" } {
if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { schelp $nick}
}}
proc advertise { nick uhost hand chan arg } {
global advertisetext advertise advertiseonlyifonline
if {$advertise == "1" && $advertiseonlyifonline == "0"} { poststuff privmsg "$advertisetext" }
if {$advertise == "1" && $advertiseonlyifonline == "1" && [status] == 1} { poststuff privmsg "$advertisetext" }
}
proc setdj {nickname djnickname } {
if {$djnickname == "" } { set djnickname $nickname }
global streamip streamport streampass dj
putlog "shoutcast: new dj: $djnickname ($nickname)"
set temp [open "dj" w+]
puts $temp $djnickname
close $temp
set temp [open "djnick" w+]
puts $temp $nickname
close $temp
if { [status] == "1" } { poststuff privmsg "$djnickname er nå deres vert, enjoy."
if { $ctodjc == "1" } {
set temp [open "isonline" r]
while {[eof $temp] != 1} {
set zeile [gets $temp]
if {[string first "isonline:" $zeile] != -1 } { set oldisonline $zeile }
if {[string first "curlist:" $zeile] != -1 } { set oldcurlist $zeile }
if {[string first "curhigh:" $zeile] != -1 } { set oldcurhigh $zeile }
if {[string first "cursong:" $zeile] != -1 } { set oldsong $zeile }
if {[string first "bitrate:" $zeile] != -1 } { set oldbitrate $zeile }
}
close $temp
}
} else {
putserv "privmsg $nickname :Dette ble ikke sendt vidre fordi radioen er offline." }
}
proc msg_setdj { nick uhost hand arg } { setdj $nick $arg }
proc pub_setdj { nick uhost hand chan arg } { global adminchans; if {([lsearch -exact [string tolower $adminchans] [string tolower $chan]] != -1) || ($adminchans == "")} { setdj $nick $arg }}
proc unsetdj { nick } {
global dj
set dj ""
file delete dj
putserv "notice $nick :dj deleted"
}
proc msg_unsetdj { nick uhost hand arg } { unsetdj $nick }
proc pub_unsetdj { nick uhost hand chan arg } { global adminchans; if {([lsearch -exact [string tolower $adminchans] [string tolower $chan]] != -1) || ($adminchans == "")} { unsetdj $nick }}
proc listener { target } {
global streamip streamport streampass
putlog "shoutcast: $target requested listener count"
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 repl [string range $bl [shrink + 19 "<REPORTEDLISTENERS>" 0 $bl] [shrink - 1 "</REPORTEDLISTENERS>" 0 $bl]]
set curhigh [string range $bl [shrink + 15 "<PEAKLISTENERS>" 0 $bl] [shrink - 1 "</PEAKLISTENERS>" 0 $bl]]
set maxl [string range $bl [shrink + 14 "<MAXLISTENERS>" 0 $bl] [shrink - 1 "</MAXLISTENERS>" 0 $bl]]
set avgtime [string range $bl [shrink + 13 "<AVERAGETIME>" 0 $bl] [shrink - 1 "</AVERAGETIME>" 0 $bl]]
}}
close $sock
putserv "notice $target :akkurat nå er det $repl personer som hører på, maximum lyttere er $maxl, vår lytter rekord var på $curhigh lyttere, gjennomsnittstiden er $avgtime sekunder"
}}
proc msg_listener { nick uhost hand arg } { listener $nick }
proc pub_listener { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { listener $nick }}
proc wish { nick arg } {
if {$arg == ""} { putserv "notice $nick :Du glemte å skrive inn ett ønske"; return 0}
if { [status] == "1" } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $djnick :(Ønske) - $nick - $arg"
} else {
putserv "notice $nick :sorry radioen er offline akkurat nå" }
}
proc msg_wish { nick uhost hand arg } { wish $nick $arg }
proc pub_wish { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { wish $nick $arg }}
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"
}}
proc msg_lastsongs { nick uhost hand arg } { sclastsongs $nick }
proc pub_lastsongs { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { sclastsongs $nick }}
proc scstream { target } {
global streamip streamport streamtext
putlog "shoutcast: streaminfo requested by $target"
putserv "notice $target :$streamtext"
}
proc msg_stream { nick uhost hand arg } { scstream $nick }
proc pub_stream { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scstream $nick }}
proc scgreet { nick arg } {
if {$arg == ""} { putserv "notice $nick :du glemte å gi en hilsen"; return 0}
if { [status] == "1" } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $djnick :(Hilsen) - $nick - $arg"
} else {
putserv "notice $nick :sorry radioen offline akkurat nå" }
}
proc msg_greet { nick uhost hand arg } { scgreet $nick $arg }
proc pub_greet { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scgreet $nick $arg }}
proc djnickchange { oldnick uhost hand chan newnick } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
if {$oldnick == $djnick} {
putlog "shoutcast: dj nickchange $oldnick -> $newnick"
set temp [open "djnick" w+]
puts $temp $newnick
close $temp
}}
proc dj { target } {
global streamip streamport streampass dj
putlog "shoutcast: $target spurte om djinfo"
if {[status] == 1} {
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
putserv "notice $target :$dj er nå deres vert!"
} else { putserv "notice $target :sorry, ingen dj" }
} else { putserv "notice $target :sorry radioen er offline" }
}
proc msg_dj { nick uhost hand arg } { dj $nick"}
proc pub_dj { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { dj $nick }}
proc scstat {target} {
global streamip streamport streampass
putlog "shoutcast: $target asked for serverstats"
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 repl [string range $bl [shrink + 19 "<REPORTEDLISTENERS>" 0 $bl] [shrink - 1 "</REPORTEDLISTENERS>" 0 $bl]]
set curhigh [string range $bl [shrink + 15 "<PEAKLISTENERS>" 0 $bl] [shrink - 1 "</PEAKLISTENERS>" 0 $bl]]
set currentl [string range $bl [shrink + 18 "<CURRENTLISTENERS>" 0 $bl] [shrink - 1 "</CURRENTLISTENERS>" 0 $bl]]
set surl [string range $bl [shrink + 11 "<SERVERURL>" 0 $bl] [shrink - 1 "</SERVERURL>" 0 $bl]]
set maxl [string range $bl [shrink + 14 "<MAXLISTENERS>" 0 $bl] [shrink - 1 "</MAXLISTENERS>" 0 $bl]]
set bitrate [string range $bl [shrink + 9 "<BITRATE>" 0 $bl] [shrink - 1 "</BITRATE>" 0 $bl]]
set stitle [string range $bl [shrink + 13 "<SERVERTITLE>" 0 $bl] [shrink - 1 "</SERVERTITLE>" 0 $bl]]
set sgenre [string range $bl [shrink + 13 "<SERVERGENRE>" 0 $bl] [shrink - 1 "</SERVERGENRE>" 0 $bl]]
if {$sgenre != ""} {set sgenre " ($sgenre)"}
set avgtime [string range $bl [shrink + 13 "<AVERAGETIME>" 0 $bl] [shrink - 1 "</AVERAGETIME>" 0 $bl]]
set irc [string range $bl [shrink + 5 "<IRC>" 0 $bl] [shrink - 1 "</IRC>" 0 $bl]]
set icq [string range $bl [shrink + 5 "<ICQ>" 0 $bl] [shrink - 1 "</ICQ>" 0 $bl]]
if {$icq == 0} { set icq "N/A" }
set aim [string range $bl [shrink + 5 "<AIM>" 0 $bl] [shrink - 1 "</AIM>" 0 $bl]]
set webhits [string range $bl [shrink + 9 "<WEBHITS>" 0 $bl] [shrink - 1 "</WEBHITS>" 0 $bl]]
set streamhits [string range $bl [shrink + 12 "<STREAMHITS>" 0 $bl] [shrink - 1 "</STREAMHITS>" 0 $bl]]
set version [string range $bl [shrink + 9 "<VERSION>" 0 $bl] [shrink - 1 "</VERSION>" 0 $bl]]
if {$streamstatus == 1} {
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
} else { set dj "none" }
putserv "notice $target :$stitle$sgenre er online, bruker shoutcast $version å sender med $bitrate kbps, din dj er $dj."
} else {
putserv "notice $target :$stitle$sgenre er offline akkurat nå, bruker shoutcast $version og sender med $bitrate kbps, sjekk ut $surl" }
putserv "notice $target :akkurat nå er det $repl personer som lytter, maximum lyttere er $maxl, vår lytter rekord var $curhigh lyttere."
putserv "notice $target :gjennomsnittstiden for vår lyttere er $avgtime sekunder, vår sending hadde $webhits webhits og $streamhits streamhits."
putserv "notice $target :du kan kontakte vertene på $irc , via aim på $aim og med icq på uin $icq."
}}
close $sock
}}
proc msg_scstat { nick uhost hand arg } { scstat $nick}
proc pub_scstat { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scstat $nick }}
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 :Now Playing $songtitle"
} else {
putserv "notice $target :serveren er offline, sorry"
}}}
close $sock
}}
proc msg_playing { nick uhost hand arg } { playing $nick}
proc pub_playing { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { playing $nick }}
proc isonline { nick uhost hand chan arg } {
global radiochans announce tellusers tellsongs tellbitrate urltopic dj
global offlinetext offlinetopic onlinetext onlinetopic
global streamip streampass streamport dj
global doalertadmin alertadmin
if {$announce == 1 || $tellsongs == 1 || $tellusers == 1 || $tellbitrate == 1} {
set isonlinefile "isonline"
set oldisonline "isonline: 0"
set oldcurlist "curlist: 0"
set oldcurhigh "curhigh: 0"
set oldsong "cursong: 0"
set oldbitrate "bitrate: 0"
if {[file exists $isonlinefile]} {
putlog "shoutcast: sjekker om stream er online"
set temp [open "isonline" r]
while {[eof $temp] != 1} {
set zeile [gets $temp]
if {[string first "isonline:" $zeile] != -1 } { set oldisonline $zeile }
if {[string first "curlist:" $zeile] != -1 } { set oldcurlist $zeile }
if {[string first "curhigh:" $zeile] != -1 } { set oldcurhigh $zeile }
if {[string first "cursong:" $zeile] != -1 } { set oldsong $zeile }
if {[string first "bitrate:" $zeile] != -1 } { set oldbitrate $zeile }
}
close $temp
}
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 "isonline: [string range $bl [shrink + 14 "<STREAMSTATUS>" 0 $bl] [shrink - 1 "</STREAMSTATUS>" 0 $bl]]"
set repl "curlist: [string range $bl [shrink + 19 "<REPORTEDLISTENERS>" 0 $bl] [shrink - 1 "</REPORTEDLISTENERS>" 0 $bl]]"
set curhigh "curhigh: [string range $bl [shrink + 15 "<PEAKLISTENERS>" 0 $bl] [shrink - 1 "</PEAKLISTENERS>" 0 $bl]]"
set currentl [string range $bl [shrink + 18 "<CURRENTLISTENERS>" 0 $bl] [shrink - 1 "</CURRENTLISTENERS>" 0 $bl]]
set surl "serverurl: [string range $bl [shrink + 11 "<SERVERURL>" 0 $bl] [shrink - 1 "</SERVERURL>" 0 $bl]]"
set cursong "cursong: [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]]
set bitrate "bitrate: [string range $bl [shrink + 9 "<BITRATE>" 0 $bl] [shrink - 1 "</BITRATE>" 0 $bl]]"
set stitle "stitle: [string range $bl [shrink + 13 "<SERVERTITLE>" 0 $bl] [shrink - 1 "</SERVERTITLE>" 0 $bl]]"
set sgenre "sgenre: [string range $bl [shrink + 13 "<SERVERGENRE>" 0 $bl] [shrink - 1 "</SERVERGENRE>" 0 $bl]]"
}}
close $sock
}
set temp [open "isonline" w+]
puts $temp "$streamstatus\n$repl\n$curhigh\n$cursong\n$bitrate\n$stitle\n$sgenre\n$surl"
close $temp
if {$announce == 1 } {
if {$streamstatus == "isonline: 0" && $oldisonline == "isonline: 1"} {
poststuff privmsg $offlinetext
if {$doalertadmin == "1"} { sendnote domsen $alertadmin "radioen er nå offline" }
if {$urltopic == 1} { poststuff topic $offlinetopic }
}
if {$streamstatus == "isonline: 1" && $oldisonline == "isonline: 0" } {
if {$sgenre != ""} {
set sgenre " ([lrange $sgenre 1 [llength $sgenre]] )"
}
poststuff privmsg "$onlinetext"
if {$urltopic == 1} { poststuff topic "$onlinetopic" }
}}
if {($tellusers == 1) && ($streamstatus == "isonline: 1") && ($oldcurhigh != "curhigh: 0") } {
if {$oldcurhigh != $curhigh} {
poststuff privmsg "ny lytter rekord: [lindex $curhigh 1]"
}
if {$oldcurlist != $repl} {
poststuff privmsg "Now there is [lindex $repl 1] ($currentl) Listeners Tuned In "
}}
if {($tellsongs == 1) && ($oldsong != $cursong) && ($streamstatus == "isonline: 1") } {
if {$songurl != ""} { set songurl " ($songurl)"}
regsub -all "<" $cursong "<" cursong
regsub -all ">" $cursong ">" cursong
regsub -all "&" $cursong "+" cursong
regsub -all """ $cursong "\"" cursong
regsub -all "'" $cursong "'" cursong
regsub -all "ÿ" $cursong "" cursong
regsub -all "´" $cursong "´" cursong
regsub -all "–" $cursong "-" cursong
regsub -all "ö" $cursong "ö" cursong
regsub -all "ä" $cursong "ä" cursong
regsub -all "ü" $cursong "ü" cursong
regsub -all "Ö" $cursong "Ö" cursong
regsub -all "Ä" $cursong "Ä" cursong
regsub -all "Ü" $cursong "Ü" cursong
regsub -all "ß" $cursong "ß" cursong
putlog $cursong
poststuff privmsg "Now Playing: [lrange $cursong 1 [llength $cursong]]"
}
if {($tellbitrate == 1) && ($oldbitrate != $bitrate) && ($streamstatus == "isonline: 1") && ($oldbitrate != "bitrate: 0")} {
poststuff privmsg "bitrate byttet til [lindex $bitrate 1]kbps"
}}}
putlog "*** shoutcast.nor.tcl v1.03 oversatt av DevilWolf <devilwolf@gmail.com> loaded."
Thanks willyw for the support and help