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 

shoutcast [SOLVED]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Thu Jun 21, 2007 1:36 pm    Post subject: shoutcast [SOLVED] Reply with quote

Hey all

i have some trouble with my radio.tcl.
I will have it to trigger only on dj's with @ and ~ of couse.
how can i do that i have tryed diffrent things like [isop nick chan] but get only errors Sad


Code:

# config ##########################

set radiochans "#chan"
set adminchans ""
set streamip "stream server"
#set streamip "ip"
#set streamip "ip"
set streamport "8000"
set streampass "pass"
#set scstatstrigger "!stats"
set scstreamtrigger "!radio"
set scplayingtrigger "!sang"
set sclistenertrigger "!lyttere"
set scdjtrigger "!dj"
set scsetdjtrigger "!setdj"
set scunsetdjtrigger "!unsetdj"
set scwishtrigger "!ønsk"
set scgreettrigger "!hils"
set schelptrigger "!radiohelp"

set alertadmin "1"
set doalertadmin "1"

set announce "1"

set urltopic "1"
set ctodjc "1"
set tellsongs "1"
set tellusers "1"
set tellbitrate "1"

set advertise "0"
set advertiseonlyifonline "1"

set offlinetext "Så stopper radioen"

#set radiotopic "..:: Velkommen til #paddysfm.dk :: Radioen er online med Non-Stop :: ::..
#set topicend   ""

set onlinetext "10 /stitle/ er nu online @ 9 /surl/ med 10 /bitrate/kbits"

#set streamtext "9Lyt til $djnickname 3.::. 7http://$streamip:$streamport/listen.pls"
set streamtext "2Lyt Med På: 4http://$streamip:$streamport/listen.pls"


#set advertisetext "9Lyt med til 11 $dj  7på http://$streamip:$streamport/listen.pls"

set advertisetext "11www.paddysfm.dk - Siden for dig der kan lide at bestemme hvad vi skal høre "

# 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 - $scsetdjtrigger  pub_setdj
#bind msg - $scsetdjtrigger  msg_setdj

bind pub - $scunsetdjtrigger  pub_unsetdj
#bind msg - $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 nick - * 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] }


#bind pub - !settopic pfm.settopic
proc pfm.settopic { nick uhost hand chan arg } {
global radiotopic topicend adminchans
if { [string tolower $chan] != "" } {

set status [status]


if { $status == 0 } {
  regsub -all -- {###radio###}                    $radiotopic "04Radio" radiotopic
 
 
  set topicend $arg
  putserv "topic #paddysfm.dk : $radiotopic :: $arg ::.."
 
}

if { $status == 1 } {
  regsub -all -- {###radio###}                    $radiotopic "09Radio" radiotopic
 
 
  set topicend $arg
  putserv "topic #paddysfm.dk : $radiotopic :: $arg ::.."
 
}
 

}

bind pub - !settopictekst mwb.setofftopic
proc mwb.setofftopic { nick uhost hand chan arg } {
global radiotopic adminchans

if { [string tolower $chan] != "#mwbstaff" } {

set status [status]
if { $status == 0 } {
  regsub -all -- {04Radio}                    $arg "###radio###" arg
}

if { $status == 1 } {
  regsub -all -- {09Radio}                    $arg "###radio###" arg
}

  set radiotopic $arg
 

}}}



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 :2$scstreamtrigger - 2$scplayingtrigger - 2$scdjtrigger - 2$scwishtrigger - 2$scgreettrigger - 2$sclistenertrigger"
}

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 } {
global streamip streamport streampass dj ctodjc
if {$djnickname == "" } { set djnickname $nickname }

putlog "shoutcast: new dj: $djnickname ($nickname)"
set temp [open "dj" w+]
puts $temp $djnickname
close $temp
set temp [open "djnick" w+]
puts $temp $djnickname
close $temp
set temp [open "djnick" w+]
puts $temp $djnickname
close $temp
if { [status] == "1" } { poststuff privmsg "2Ny vært er på radioen"
poststuff privmsg "2Tag Godt Imod: 4$djnickname "
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 :9this has not been announced because the radio is currentlfy 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 max [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 "privmsg $target : 2PaddysFM Lyttere: 4 $repl / $curhigh "
}}

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 $chan }}

proc wish { nick arg } {
if {$arg == ""} { putserv "notice $nick :you forgot to add your wish"; return 0}
if { [status] == "1" } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $djnick :(WISH) - $nick - $arg"
putserv "notice $nick : Dit ønske er sendt til den nuværende DJ"
} else {
putserv "notice $nick :Radioen er pt offline" }
}


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 "&#x3C;" $songs "<" songs
regsub -all "&#x3E;" $songs ">" songs
regsub -all "&#x26;" $songs "+" songs
regsub -all "&#x22;" $songs "\"" songs
regsub -all "&#x27;" $songs "'" songs
regsub -all "&#xFF;" $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 "&#xB;" $songs "´" songs
regsub -all "&#x96;" $songs "-" songs
regsub -all "&#xF6;" $songs "ö" songs
regsub -all "&#xE4;" $songs "ä" songs
regsub -all "&#xFC;" $songs "ü" songs
regsub -all "&#xD6;" $songs "Ö" songs
regsub -all "&#xC4;" $songs "Ä" songs
regsub -all "&#xDC;" $songs "Ü" songs
regsub -all "&#xDF;" $songs "ß" songs

regsub -all "&#xE;" $songs "å" songs
regsub -all "&#xE;" $songs "æ" songs
regsub -all "&#xF;" $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 :you forgot to add your greetmessage"; return 0}
if { [status] == "1" } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $djnick :(GREET) - $nick - $arg"
} else {
putserv "notice $nick :Radioen er pt offline" }
}


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 asked for dj info"
if {[status] == 1} {
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
putserv "privmsg $target :2Lige Nu:  4$dj "
} else { putserv "notice $target :dj'en er offline" }
} else { putserv "notice $target :Radioen er pt 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 $chan  }}



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]]

regsub -all "&#xE5;" $sgenre "å" sgenre
regsub -all "&#xE6;" $sgenre "æ" sgenre
regsub -all "&#xF8;" $sgenre "ø" sgenre

regsub -all "&#xE5;" $stitle "å" stitle
regsub -all "&#xE6;" $stitle "æ" stitle
regsub -all "&#xF8;" $stitle "ø" stitle

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 is online, running shoutcast $version and streaming at $bitrate kbps,  your dj is $dj. please visit $surl"
#} else {
#putserv "notice $target :$stitle$sgenre is currenty offline, running shoutcast $version and streaming at $bitrate kbps, check out $surl" }
#putserv "notice $target :there are currently $repl unique people listening, the listener maximum is $maxl, our user peak was at $curhigh listeners."
#putserv "notice $target :the average user is listening $avgtime seconds, our stream had $webhits webhits and $streamhits streamhits."
}}
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 "&#x3C;" $songtitle "<" songtitle
regsub -all "&#x3E;" $songtitle ">" songtitle
regsub -all "&#x26;" $songtitle "+" songtitle
regsub -all "&#x22;" $songtitle "\"" songtitle
regsub -all "&#x27;" $songtitle "'" songtitle
regsub -all "&#xFF;" $songtitle "" songtitle
regsub -all "&#xB4;" $songtitle "´" songtitle
regsub -all "&#x96;" $songtitle "-" songtitle
regsub -all "&#xF6;" $songtitle "ö" songtitle
regsub -all "&#xE4;" $songtitle "ä" songtitle
regsub -all "&#xFC;" $songtitle "ü" songtitle
regsub -all "&#xD6;" $songtitle "Ö" songtitle
regsub -all "&#xC4;" $songtitle "Ä" songtitle
regsub -all "&#xDC;" $songtitle "Ü" songtitle
regsub -all "&#xDF;" $songtitle "ß" songtitle


regsub -all "&#xE5;" $songtitle "å" songtitle
regsub -all "&#xE6;" $songtitle "æ" songtitle
regsub -all "&#xF8;" $songtitle "ø" songtitle

if {$streamstatus == 1} {
#putserv "privmsg $target :9Lige nu spilles: $songtitle$songurl"
#putserv "privmsg $target :9Lige nu spilles: 7$songtitle 9"
putserv "privmsg $target :2Lige Nu: 4 $songtitle "
} else {
putserv "notice $target :server is currently 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 $chan  }}



proc isonline { nick uhost hand chan arg } {
global radiochans announce tellusers tellsongs tellbitrate urltopic dj
global offlinetext onlinetext radiotopic topicend
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: checking if stream is 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 "radio is now offline" }
   if {$urltopic == 1} {
   regsub -all -- {09Radio}                    $radiotopic "04Radio" radiotopic
   regsub -all -- {###radio###}                  $radiotopic "04Radio" radiotopic
   poststuff topic "$radiotopic :: $topicend ::.."
   }
}
if {$streamstatus == "isonline: 1" && $oldisonline == "isonline: 0" } {
   if {$sgenre != ""} {
   set sgenre " ([lrange $sgenre 1 [llength $sgenre]] )"
   }
   poststuff privmsg "$onlinetext"
   if {$urltopic == 1} {
   regsub -all -- {04Radio}                    $radiotopic "09Radio" radiotopic
   regsub -all -- {###radio###}                  $radiotopic "09Radio" radiotopic
   poststuff topic "$radiotopic :: $topicend ::.."
   }
}}
if {($tellusers == 1) && ($streamstatus == "isonline: 1") && ($oldcurhigh != "curhigh: 0") } {
if {$oldcurhigh != $curhigh} {
poststuff privmsg "Lytter max er: [lindex $curhigh 1]"
}
if {$oldcurlist != $repl} {
#poststuff privmsg "9Pirate Hits Radio lyttere: $currentl"
}}
if {($tellsongs == 1) && ($oldsong != $cursong) && ($streamstatus == "isonline: 1") } {
if {$songurl != ""} { set songurl " ($songurl)"}
regsub -all "&#x3C;" $cursong "<" cursong
regsub -all "&#x3E;" $cursong ">" cursong
regsub -all "&#x26;" $cursong "+" cursong
regsub -all "&#x22;" $cursong "\"" cursong
regsub -all "&#x27;" $cursong "'" cursong
regsub -all "&#xFF;" $cursong "" cursong
regsub -all "&#xB4;" $cursong "´" cursong
regsub -all "&#x96;" $cursong "-" cursong
regsub -all "&#xF6;" $cursong "ö" cursong
regsub -all "&#xE4;" $cursong "ä" cursong
regsub -all "&#xFC;" $cursong "ü" cursong
regsub -all "&#xD6;" $cursong "Ö" cursong
regsub -all "&#xC4;" $cursong "Ä" cursong
regsub -all "&#xDC;" $cursong "Ü" cursong
regsub -all "&#xDF;" $cursong "ß" cursong

regsub -all "&#xE5;" $cursong "å" cursong
regsub -all "&#xE6;" $cursong "æ" cursong
regsub -all "&#xF8;" $cursong "ø" cursong



putlog $cursong
#poststuff privmsg "9Paddysfm spiller: [lrange $cursong 1 [llength $cursong]]$songurl"
poststuff privmsg "10DJ 10spiller: 9[lrange $cursong 1 [llength $cursong]]10 @ http://193.201.54.28:8000/listen.pls"
}

if {($tellbitrate == 1) && ($oldbitrate != $bitrate) && ($streamstatus == "isonline: 1") && ($oldbitrate != "bitrate: 0")} {
poststuff privmsg "bitrate switched to [lindex $bitrate 1]kbps"
}}}


*EDIT* i have edited the script so the whole thing is here Smile
Thanks in advance
Fire-Fox
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze


Last edited by Fire-Fox on Thu Sep 20, 2007 11:10 am; edited 3 times in total
Back to top
View user's profile Send private message MSN Messenger
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Thu Jun 21, 2007 6:00 pm    Post subject: Reply with quote

You've omitted part of the script, hopefully that isn't the entire thing.. I see no way for your procs to even run, nothing appears bound to them.
You can use binds to easily accomplish your goal.
Back to top
View user's profile Send private message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Fri Jun 22, 2007 11:32 am    Post subject: Reply with quote

i have added the full script, maybe that helps Smile
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Jun 22, 2007 6:35 pm    Post subject: Reply with quote

Use [isop] and [ishalfop] to detect if a user is oped/halfoped. Read about them in Tcl-commands.doc.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
nikolamkd
Voice


Joined: 16 May 2008
Posts: 2

PostPosted: Fri May 16, 2008 7:15 am    Post subject: help Reply with quote

hi can someone help me when i trying to start the bot i get this:
Warning! eggdrop.conf file is missing or has errors. BOT shutdowned. Error: can't set "temp": variable is array
Back to top
View user's profile Send private message
ztian299
Halfop


Joined: 19 Apr 2008
Posts: 59
Location: *.no

PostPosted: Fri May 16, 2008 11:12 am    Post subject: Reply with quote

did you use the original eggdrop.conf and edited it properly?
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri May 16, 2008 11:25 am    Post subject: Re: help Reply with quote

nikolamkd wrote:
hi can someone help me when i trying to start the bot i get this:
Warning! eggdrop.conf file is missing or has errors. BOT shutdowned. Error: can't set "temp": variable is array

This is likely caused by a script you have loaded. It would help if you posted the entire error.
Back to top
View user's profile Send private message
nikolamkd
Voice


Joined: 16 May 2008
Posts: 2

PostPosted: Fri May 16, 2008 1:00 pm    Post subject: Reply with quote

its the script upper the shoutcast script, but when i first load it it works now it gets that error Sad
Back to top
View user's profile Send private message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Wed Jun 18, 2008 7:33 am    Post subject: Reply with quote

nikolamkd wrote:
its the script upper the shoutcast script, but when i first load it it works now it gets that error Sad



What error are you getting ?
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
jaynzl
Voice


Joined: 09 Apr 2011
Posts: 3

PostPosted: Sat Apr 16, 2011 7:46 am    Post subject: (Quit: Warning! eggdrop.conf file is missing or has errors. Reply with quote

Anyone get an answer for this error?

Apparently happens with shoutcast1.03.tcl
You can reset eggdrop from new, it will run the first time without a problem. However once eggdrop disconnects or if you .rehash in the partyline bot crashes with error in the topic.
(Quit: Warning! eggdrop.conf file is missing or has errors. BOT shutdowned. Error: can't set "temp": variable is array)

When you try to restart ./eggdrop bot1.conf, you get the following error:
Quote:

** shoutcast.tcl v1.03 by domsen <domsen@domsen.org> succesfully loaded. turn it up baby.
[11:00] Tcl error in file 'JukeBox-AA.conf':
[11:00] couldn't save command result in variable
while executing
"catch {source eggdrop.conf} temp(config_error_info)"
invoked from within
"set temp(config_error) [catch {source eggdrop.conf} temp(config_error_info)] "
(file "JukeBox-AA.conf" line 49)
[11:00] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)

Now, if i remove shoutcast.tcl from config file and restart eggdrop , it connects without a problem, but means unable to use shoutcast.tcl of course.

Anyone else come across this issue or able to point me to another post with resolve?

Thanks in advance.
Jase
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases 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