CrazyCat wrote:The thing we need is what your shoutcast server (not the script, the
shoutcat server) send or can send when you go to
https://your.shoutcast.server/admin.cgi ... de=viewxml
And to know if you can have another output than xml, probably by changing the mode value in the url.
Happy New Year
CrazyCat returning to the subject of the errors of ñ, commas, and rare symbols, etc.
I paste the tcl that I use for shoutcast that I can't find the solution
Code: Select all
set radiochans "##sala1 #sala2"
set otrachan "#sala2"
set otrachans "##sala1"
set adminchans "#sala3"
set adminchans1 "#sala3"
set streamip "123.456.789.11"
set streamport "1234"
set streampass "pass"
set scstatstrigger "!estado"
set scstreamtrigger "!radio"
set scplayingtrigger "!tema"
set sclistenertrigger "!oyentes"
set scdjtrigger "!dj"
set scsetdjtrigger "!emito"
set scunsetdjtrigger "!auto"
set scwishtrigger "!peticion"
set scgreettrigger "!saludos"
set sclastsongstrigger "!ultimas"
set schelptrigger "!comandos"
set alertadmin ""
set doalertadmin "1"
set announce "1"
set urltopic "0"
set ctodjc "1"
set tellsongs "1"
set tellusers "1"
set tellbitrate "1"
set advertise "1"
#si el bot solo debe anunciar la radio si la transmisión está en funcionamiento, 0 para publicidad permanente 1
set advertiseonlyifonline "0"
##el texto que el bot publicará solo una vez cuando no emitas en directo server on.
set offlinetext "10A2ctualmente 10e2stá 2S10onando 10E2n 12Automatico: 12Pon en tu navegador 9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
#set offlinetopic ""
#
set onlinetext "11A1ctualmente está 10S1onando on 12L1ine: 12Pon en tu navegador 4: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
#set onlinetext ""
#set onlinetext ""
#set onlinetopic ""
#set streamtext ""
#set streamtext ""
#el texto que el bot publicará cuando no emitas en directo server on.
#set advertisetext ""
#set advertisetext1 "10E2scuchanos 10e2n: 12----> 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 12 11 13 10L2a 10R2adio 10Q2ue 10T2e 10A2compaña 13 11 12 ,10G2racias 10P2or 10Escuch2arnos "
#set advertisetext "10E2stamos 10A2ctualmente 10e2n: 12----> 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 12 11 13 10L2a 10R2adio 10Q2ue 10T2e 10A2compaña 13 11 12 ,10G2racias 10P2or 10Escuch2arnos "
# end of config #####################
#!estado
bind pub n $scstatstrigger pub_scstat
bind msg n $scstatstrigger msg_scstat
#!enlace
bind pub - $scplayingtrigger pub_playing
bind msg - $scplayingtrigger msg_playing
#!dj
bind pub - $scdjtrigger pub_dj
bind msg - $scdjtrigger msg_dj
#!emito
bind pub D $scsetdjtrigger pub_setdj
bind msg D $scsetdjtrigger msg_setdj
#!auto
bind pub D $scunsetdjtrigger pub_unsetdj
bind msg D $scunsetdjtrigger msg_unsetdj
#!peticion
bind pub - $scwishtrigger pub_wish
bind msg - $scwishtrigger msg_wish
#!saludos
bind pub - $scgreettrigger pub_greet
bind msg - $scgreettrigger msg_greet
#!radio
bind pub - $scstreamtrigger pub_stream
bind msg - $scstreamtrigger msg_stream
#!ultimas
bind pub n $sclastsongstrigger pub_lastsongs
bind msg n $sclastsongstrigger msg_lastsongs
#!oyentes
bind pub n $sclistenertrigger pub_listener
bind msg n $sclistenertrigger msg_listener
#!comandos
bind pub - $schelptrigger pub_help
bind msg - $schelptrigger msg_help
#bind time - "* * * * *" isonline
bind time - "*15 * * * *" isonline
#bind time - "*12 * * * *" isonline
bind time - "95 * * * *" advertise
bind nick - * djnickchange
#bind pub n !facebook pub_facebook
bind pub n !xiialive pub_xiialive
#bind pub - !tunein pub_tunein
#bind pub - !winamp pub_winamp
#bind pub n !reproductor pub_reproductor
bind pub D !abre pub_abrepeticiones
bind pub D !cierra pub_cierrapeticiones
bind pub D !status.peticiones pub_statuspeticiones
bind pub n !adminchan proc_adminchan
bind pub n !adminchandj proc_adminchandj
bind pub - !canales proc_canales
set dj ""
set surl ""
set bitrate ""
set stitle ""
set djciudad ""
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
}
####prueba
proc cl_chanlist { } {
global botnick
set chanlist ""
foreach chan [channels] {
append chanlist "$chan "
}
return $chanlist
}
proc proc_canales { nick uhost hand chan arg } {
global radiochans
putserv "privmsg $chan : Los canales son $radiochans "
}
proc proc_adminchan { nick uhost hand chan arg } {
global adminchans
putserv "privmsg $chan : El canal es $adminchans "
}
proc proc_adminchandj { nick uhost hand chan arg } {
global adminchans1
putserv "privmsg $chan : El canal es $adminchans1 "
}
proc pub_xiialive { nick uhost hand chan arg } {
putserv "privmsg $chan : 1Fuera de Servicio."
}
#proc pub_facebook { nick uhost hand chan arg } {
#putserv "privmsg $chan :"
#}
#proc pub_tunein { nick uhost hand chan arg } {
#putserv "privmsg $chan : "
#}
#proc pub_winamp { nick uhost hand chan arg } {
#putserv "privmsg $chan : "
#}
#proc pub_reproductor { nick uhost hand chan arg } {
#putserv "privmsg $chan : "
#}
proc pub_abrepeticiones { nick uhost hand chan arg } {
global adminchans1 radiochans otrachan
if {([lsearch -exact [string tolower $adminchans1] [string tolower $chan]] != -1) || ($adminchans1 == "")} {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $adminchans1 :PETICIONES: Las Peticiones han sido abierta"
putserv "privmsg $radiochans 12 $djnick 10A2ßre 10L2as 10P2eticiones, 10P2ide 10u2n 10T2ema 10C2on 10e2l 10C10omando 12!peticion 10Tema - 2Cantante "
putserv "privmsg $otrachan 2 $djnick 10A2ßre 10L2as 10P2eticiones, 10P2ide 10u2n 10T2ema 10C2on 10e2l 10C10omando 12!peticion 10Tema - 2Cantante "
set temp [open "peticiones" w+]
puts $temp "Abiertas"
close $temp
}
}
proc pub_cierrapeticiones { nick uhost hand chan arg } {
global adminchans1 radiochans otrachans
if {([lsearch -exact [string tolower $adminchans1] [string tolower $chan]] != -1) || ($adminchans1 == "")} {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $adminchans1 :PETICIONES: Las Peticiones han sido cerradas"
putserv "privmsg $radiochans 12 $djnick 10C2ierra 10L2as 10P2eticiones, 10S2igue 10E2scuchandonos "
putserv "privmsg $otrachans 12 $djnick 10C2ierra 10L2as 10P2eticiones, 10S2igue 10E2scuchandonos "
set temp [open "peticiones" w+]
puts $temp "Cerradas"
close $temp
}
}
proc pub_statuspeticiones { nick uhost hand chan arg } {
set temp [open "peticiones" r]
set peticiones [gets $temp]
close $temp
putserv "privmsg $chan :PETICIONES: 10E2STADO De Las Peticiones 12$peticiones "
}
###Modulo para agregar ciudad
bind pub D !ciudad pub_setciudad
proc pub_setciudad { nick uhost hand chan arg } { global adminchans1; if {([lsearch -exact [string tolower $adminchans1] [string tolower $chan]] != -1) || ($adminchans1 == "")} { setciudad $arg }}
proc setciudad { djciudad } {
#putlog "shoutcast: $djciudad "
if {$djciudad == "" } { set djciudad $djciudad }
global streamip streamport streampass dj
#putlog "shoutcast: Nuevo Ciudad agregada para $dj ( $djciudad )"
set temp [open "ciudad" w+]
puts $temp $djciudad
close $temp
rehash
}
### Fin Modulo
bind pub - !siguiente pub_siguiente
proc pub_siguiente { nick uhost hand chan arg } {
exec killall sc_trans_linux -WINCH
#putlog "shoutcast: Cambio de canción pedido por $nick"
}
bind pub - !playlist pub_playlist
proc pub_playlist { nick uhost hand chan arg } {
exec killall sc_trans_linux -USR1
#putlog "shoutcast: $nick pidio recargar el playlist"
}
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&sid=1&mode=viewxml&page=0 HTTP/1.1"
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 chan } {
global scstatstrigger scstreamtrigger scplayingtrigger scdjtrigger sclastsongstrigger scwishtrigger scgreettrigger sclistenertrigger radiochans
putserv "privmsg $chan : 12 $target 10L2os 10C2omandos 10d2e 10l2a 10R2adio: 10!comandos - 2!Enlace - 12!Radio - 10!Dj - 2!Peticion 10Tema 2Cantante - 12!ultimas - 10!saludos 10G2racias 10P2or 10S2intonizar 12Radio"
}
proc pub_help {nick uhost hand chan arg} {
global radiochans
if {$radiochans == "" } { schelp $nick $chan }
if {$radiochans != "" } {
if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { schelp $nick $chan }
}}
bind pub - !pruebamensaje advertise
proc advertise { nick uhost hand chan arg } {
global otrachans otrachan advertisetext advertise advertiseonlyifonline dj djciudad ciud peticiones radiochan otrachan
set temp [open "ciudad" r]
set ciud [gets $temp]
close $temp
if {$advertise == "1" && $advertiseonlyifonline == "0"} {
putserv "privmsg $otrachans 10E2stamos 10A2ctualmente 10e2n: 12----> 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 12 11 13 10L2a 10R2adio 10Q2ue 10T2e 10A2compaña 13 11 12 ,10G2racias 10P2or 10Escuch2arnos "
putserv "privmsg $otrachan 10E2scuchanos 10e2n: 12----> 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 12 11 13 10L2a 10R2adio 10Q2ue 10T2e 10A2compaña 13 11 12 ,10G2racias 10P2or 10Escuch2arnos "
}
if {$advertise == "1" && $advertiseonlyifonline == "1" && [status] == 1} {
#poststuff privmsg "$advertisetext"
putserv "privmsg $radiochans 10E02mitiendo: 12 $djnick 2P10ara 12Radio 10S2intonizanos: 12Pon en tu Navegador 9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
putserv "privmsg $otrachan 12 $djnick 10E02mitiendo 2P10ara 12Radio 10S2intonizanos: 12Pon en tu Navegador 9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
}
}
proc setdj {nickname djnickname } {
set acmd [lindex $djnickname 0]
set ciud [lrange $djnickname 1 end]
putlog "prueba $ciud"
if {$djnickname == ""} { set djnickname $ciud }
global radiochans otrachan streamip streamport streampass dj ctodjc
putserv "privmsg $otrachan 4Aviso!!!: 10E2mite 10a2hora:12 $nickname 10D2esde: 12 $ciud 10e2scuchanos 10e2n: 12Pon en tu Navegador 9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
putserv "privmsg $radiochans 4Atencion!!!: 10E2mite 10a2hora:12 $nickname 10D2esde: 12 $ciud 10e2scuchanos 10e2n: 12Pon en tu Navegador 9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
putquick "MODE ##sala1 +o $nickname"
putlog "shoutcast: Nuevo Dj: $djnickname ($nickname)"
set temp [open "dj" w+]
puts $temp $nickname
close $temp
set temp [open "djnick" w+]
puts $temp $nickname
close $temp
set temp [open "ciudad" w+]
puts $temp $nickname
close $temp
rehash
if { [status] == "1" } { poststuff privmsg ""
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 : Comando Invalido Por Motivo de tener Nuestra radio fuera de Línea (APAGADA)" }
}
proc msg_setdj { nick uhost hand arg } { setdj $nick $arg }
proc pub_setdj { nick uhost hand chan arg } { global adminchans1; if {([lsearch -exact [string tolower $adminchans1] [string tolower $chan]] != -1) || ($adminchans1 == "")} { setdj $nick $arg }}
proc unsetdj { nick } {
global radiochans otrachan dj djnick djciudad adminchans1 ciudad peticiones
putquick "MODE ##sala1 -o $dj"
putquick "MODE ##sala1 +v $dj"
putserv "privmsg $radiochans 4Aviso!!!: 10E2mite 10a2hora:12 RadioAuto 10D2esde: 12 Canarias 10c2on 10P2eticiones:12 Cerradas 10e2scuchanos 10e2n: 12Pon en tu Navegador 9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
putserv "privmsg $otrachan 4Atencion!!!: 10E2mite 10a2hora:12 RadioAuto 10D2esde: 12 Canarias 10c2on 10P2eticiones:12 Cerradas 10e2scuchanos 10e2n: 12Pon en tu Navegador 9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
set temp [open "dj" w+]
puts $temp "RadioAuto"
close $temp
set temp [open "djnick" w+]
puts $temp "RadioAuto"
close $temp
set temp [open "ciudad" w+]
puts $temp "Canarias"
close $temp
set temp [open "peticiones" w+]
puts $temp "Cerradas"
close $temp
putserv "privmsg $adminchans1 :4Dj Puesto en Automatico .."
rehash
}
proc msg_unsetdj { nick uhost hand arg } { unsetdj $nick }
proc pub_unsetdj { nick uhost hand chan arg } { global adminchans1; if {([lsearch -exact [string tolower $adminchans1] [string tolower $chan]] != -1) || ($adminchans1 == "")} { unsetdj $nick }}
proc listener { target } {
global streamip streamport streampass adminchans
putlog "shoutcast: $target cuenta solicitada del oyente"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&sid=1&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 + 18 "<CURRENTLISTENERS>" 0 $bl] [shrink - 1 "</CURRENTLISTENERS>" 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 :Actualmente hay $repl Oyente(s), La Radio Tiene Capacidad para $maxl Oyentes, el número máximo de Oyentes Hasta Ahora es de $curhigh Oyentes, el promedio de escucha es a $avgtime"
#putserv "notice $target : 6$target 14Actualmente hay 6 $repl 14Oyente(s), La Radio Tiene Capacidad para 6 $maxl 14Oyentes, el número máximo de Oyentes Hasta Ahora es de 6 $curhigh 14Oyentes, el promedio de escucha es:6 $avgtime"
}}
proc msg_listener { nick uhost hand arg } { listener $nick }
proc pub_listener { nick uhost hand chan arg } { global adminchans; if {([lsearch -exact [string tolower $adminchans] [string tolower $chan]] != -1) || ($adminchans == "")} { listener $nick }}
proc wish { nick chan arg } {
global radiochans adminchans1
if {$arg == ""} { putserv "privmsg $chan : 12$nick 10P2or 10F2avor 10E2specifica 10E2l 10T2ema 10Q2ue 10D2eseas 10P2edir 10!peticion 10Tema 2Cantante 10G2racias 10P2or 10S2intonizarnos"; return 0}
if { [status] == "1" } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
#putserv "privmsg $radiochans1 :1PEDIDO MUSICAL: 14$arg 1de Parte de 14$nick"
putserv "privmsg $adminchans1 : 10PETICION 12 $djnick 10E2L 10N2ick 12 $nick 10A 2S10olicitado 12 $arg 10En 2El 10Canal 12 $chan"
putserv "privmsg $djnick : 10PETICION 12 $djnick 10E2L 10N2ick 12 $nick 10A 2S10olicitado 12 $arg 10En 2El 10Canal 12 $chan"
putserv "privmsg $chan : 12$nick 10T2u 10P2eticion 2a 10S2ido 10R2egistrada, 10E2n 10U2n 10M2omento 10D2j 6 $djnick 10T2e 10C2omplacera."
} else {
putserv "privmsg $chan :10L2o 10S2iento 12$nick 10l2a 10R2adio 10E2sta 10E2n 10M2odo: 12Automatico :2(" }
}
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 pub_wish { nick uhost hand chan arg } {
global radiochans
set temp [open "peticiones" r]
set peticiones [gets $temp]
close $temp
if {$peticiones == "Abiertas"} {
if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "") } {
#wish $nick $arg
wish $nick $chan $arg
}
} else {
putserv "privmsg $chan : 12 $nick 10L2as 10P2eticiones 10E2stan 10C2erradas. 10S2igue 10E2scuchandonos "
}
}
proc sclastsongs { target } {
global streamip streamport streampass otrachan
putlog "shoutcast: $target Historia solicitada de la canción"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&sid=1&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 "ÿ" $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 "i" $songs "i" 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
regsub -all "ë" $songs "ë" songs
regsub -all "ñ" $songs "ñ" songs
regsub -all "{" $songs "" songs
regsub -all "}" $songs "" songs
}}
close $sock
putserv "privmsg $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"
poststuff "privmsg $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 == "")} {
#putlog "shoutcast: Enlace de Informacion solicitada por $nick"
putserv "privmsg $chan : 10 $nick 10S2intoniza 10E2n: 12Pon en tu Navegador9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
}
}
proc scgreet { nick arg } {
if {$arg == ""} { putserv "notice $nick : Olvidó de agregar su Saludos Ej:(!saludos <Tus Saludos>)"; return 0}
if { [status] == "1" } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $djnick : Enviar unos Saludos: $arg de Parte de $nick"
} else {
putserv "notice $nick : 10L2o 10S2iento 12 $nick 10l2a 10R2adio 10E2sta 10E2n 10M2odo: 12Automatico :2("}
}
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: Cambio de Nick del Dj de $oldnick a $newnick"
set temp [open "djnick" w+]
puts $temp $newnick
close $temp
}}
proc dj {target chan} {
global streamip streamport streampass dj
putlog "shoutcast: $target pedido La informacion del DJ"
if {[status] == 1} {
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
putserv "privmsg $chan :12$target 10E2mitiendo: 12 $dj 2S10intoniza 2E10n: 12Pon en tu Navegador9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
} else { putserv "privmsg $chan :12$target Lo Siento, El Dj Actual No Tiene Un Apodo o Nickname habilitado" }
} else { putserv "privmsg $chan : 10L2o 10S2iento 12$target 10l2a 10R2adio 10E2sta 10E2n 10M2odo: 12Automatico :2(" }
}
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 $chan }}
proc scstat {chan} {
global streamip streamport streampass
putlog "shoutcast: $chan pedido del Estado del servidor"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&sid=1&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 + 18 "<CURRENTLISTENERS>" 0 $bl] [shrink - 1 "</CURRENTLISTENERS>" 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 "Automático" }
putserv ""
} else {
putserv "privmsg $chan : 12 $stitle$sgenre Actualmente 2ESTA APAGADA." }
#putserv "notice $target :Actualmente hay $repl Oyentes, La Capacidad maxima es $maxl, Total de Oyentes En la Radio fue de $curhigh oyentes."
#putserv "notice $target :El tiempo promedio de escucha es de $avgtime segundos, La Radio tiene $webhits webhits y $streamhits streamhits."
putserv "privmsg $chan : Si Nuestra Radio 2ESTA EN LINEA, Use 12!dj Para ver quien es actualmente el DJ."
}}
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 chan} {
global streamip streamport streampass dj
putlog "shoutcast: $target pedido la canción actual"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&sid=1&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 "i" $songtitle "i" 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
regsub -all "}" $songtitle "" songtitle
if {$streamstatus == 1} {
putserv "privmsg $chan : 10E2mitiendo: 12 $dj 2C10ancion: 12 $songtitle 10S2intonizanos: 12Pon en tu Navegador 9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
#putserv "notice $target :Canción que suena es: 5$songtitle"
} elseif {$streamstatus == 0} {
putserv "privmsg $chan : 10A2ctualmente 10e2stá 2S10onando 10E2n 12Automatico: 12Pon en tu navegador 9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 "
} else {
putserv "privmsg $chan : El servidor es Actualmente Fuera de Línea *4APAGADO*, Lo Siento"
}}}
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 $chan }}
proc isonline { nick uhost hand chan arg } {
global radiochans otrachans otrachan 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: Comprobando si El Enlace está en LINEA"
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&sid=1&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 + 18 "<CURRENTLISTENERS>" 0 $bl] [shrink - 1 "</CURRENTLISTENERS>" 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 "La radio Esta Ahora APAGADA" }
#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 ""
#poststuff privmsg "Posibles Oyentes: [lindex $curhigh 1]"
}
if {$oldcurlist != $repl} {
poststuff privmsg ""
#poststuff privmsg " Actualmente hay : 4 [lindex $repl 1] ($currentl) Oyentes"
}}
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 "i" $cursong "i" 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
putserv "privmsg $otrachans 12Pon en tu Navegador 9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 10D2j: 12 $dj 10C2ancion 10A2ctual:12 [lrange $cursong 1 [llength $cursong]]"
putserv "privmsg $otrachan 2Emitiendo 10D2j: 12 $dj 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 10C2ancion 10A2ctual:12 [lrange $cursong 1 [llength $cursong]]"
#poststuff privmsg "1Quieres Escuchar La Radio 12Pon en tu Navegador9: 2 http://123.456.789.11:1234/widgets/player/dj/?p=5678 ... La Actual Canción es: 4 [lrange $cursong 1 [llength $cursong]] .. Para Ver Comandos de la Radio Teclea 6!comandos "
}
if {($tellbitrate == 1) && ($oldbitrate != $bitrate) && ($streamstatus == "isonline: 1") && ($oldbitrate != "bitrate: 0")} {
poststuff privmsg "Calidad Sonido a [lindex $bitrate 1]kbps"
}}}
putlog "Cargado shoutcast Correctamente"
now what my shoutcast panel sends both:
Transmission statistics: XML , JSON , JSON-PAGS
to enter the XML file the link is like this:
http://123.456.789.11:1234/stats?sid=1& ... 5678995124
this is what the XML file returns:
Code: Select all
<SHOUTCASTSERVER>
<CURRENTLISTENERS>0</CURRENTLISTENERS>
<PEAKLISTENERS>5</PEAKLISTENERS>
<MAXLISTENERS>100</MAXLISTENERS>
<UNIQUELISTENERS>0</UNIQUELISTENERS>
<AVERAGETIME>0</AVERAGETIME>
<SERVERGENRE>various</SERVERGENRE>
<SERVERGENRE2/>
<SERVERGENRE3/>
<SERVERGENRE4/>
<SERVERGENRE5/>
<SERVERURL>clientradiourl.com</SERVERURL>
<SERVERTITLE>AutoDJ Stream</SERVERTITLE>
<SONGTITLE>La Sonora Santanera - Amor de Cabaret</SONGTITLE>
<STREAMHITS>52</STREAMHITS>
<STREAMSTATUS>1</STREAMSTATUS>
<BACKUPSTATUS>0</BACKUPSTATUS>
<STREAMLISTED>0</STREAMLISTED>
<STREAMLISTEDERROR>200</STREAMLISTEDERROR>
<STREAMSOURCE>127.0.0.1</STREAMSOURCE>
<STREAMPATH>/stream</STREAMPATH>
<STREAMUPTIME>245357</STREAMUPTIME>
<BITRATE>128</BITRATE>
<SAMPLERATE>44100</SAMPLERATE>
<CONTENT>audio/mpeg</CONTENT>
<VERSION>2.5.5.733 (posix(linux x64))</VERSION>
</SHOUTCASTSERVER>
to enter the JSON file the link is like this:
http://123.456.789.11:1234/stats?sid=1& ... 124&json=1
this is what the JSON file returns:
Code: Select all
{"currentlisteners":0,"peaklisteners":5,"maxlisteners":100,"uniquelisteners":0,"averagetime":0,"servergenre":"various","servergenre2":"","servergenre3":"","servergenre4":"","servergenre5":"","serverurl":"clientradiourl.com","servertitle":"AutoDJ Stream","songtitle":"Justin Quiles x Chimbala x Zion y Lennox - Loco","streamhits":52,"streamstatus":1,"backupstatus":0,"streamlisted":0,"streamlistederror":200,"streamsource":"127.0.0.1","streampath":"\/stream","streamuptime":244458,"bitrate":"128","samplerate":"44100","content":"audio\/mpeg","version":"2.5.5.733 (posix(linux x64))"}
to enter the JSON-PAGS file the link is like this:
http://123.456.789.11:1234/stats?sid=1& ... lback=func
this is what the JSON-PAGS file returns:
Code: Select all
func({"currentlisteners":0,"peaklisteners":5,"maxlisteners":100,"uniquelisteners":0,"averagetime":0,"servergenre":"various","servergenre2":"","servergenre3":"","servergenre4":"","servergenre5":"","serverurl":"clientradiourl.com","servertitle":"AutoDJ Stream","songtitle":"K-Narias - Ya No Me Acuerdo de Ti","streamhits":52,"streamstatus":1,"backupstatus":0,"streamlisted":0,"streamlistederror":200,"streamsource":"127.0.0.1","streampath":"\/stream","streamuptime":244962,"bitrate":"128","samplerate":"44100","content":"audio\/mpeg","version":"2.5.5.733 (posix(linux x64))"})
I would be very grateful if you could help me with the correction of errors with the ñ, symbols and others, thank you very much.
PS: if you need any more information to clarify the problem I will be happy to give it to you.
good
as usual and good ways to contribute so that you can continue to help as those who I am learning, after giving a thousand turns I came up with the solution that I need the messages come out with their accents, the ñ, and other forms, I leave the solution for which you aga lack and thus contribute to this does not decline and thus continue to learn from others
I would like to thank you again very much
in this part of the code
Code: Select all
proc playing {target chan} {
global streamip streamport streampass dj
putlog "shoutcast: $target pedido la canción actual"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&sid=1&mode=viewxml&page=0 HTTP/1.1"
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)"}
as last line add this
Code: Select all
set songtitle [encoding convertfrom utf-8 [string map {"&" "&"} $songtitle]]