Cacao7w7

Untitled

Jun 28th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.18 KB | None | 0 0
  1. Configuracion
  2. ##################################################
  3.  
  4. #canales donde estara activa la tcl
  5. set radiochans "#cana1 #canal2 #canal3 #canal4 #etc"
  6. #canal de administracion de la radio
  7. set adminchans "#canal1"
  8. set streamip "ACA PONES LA IP DE TU RADIO"
  9. set streamport "ACA PONES EL PUERTO DE LA RADIO"
  10. set streampass "ACA PONES EL PASS DE LA RADIO"
  11. set scstatstrigger "!estado"
  12. set scstreamtrigger "!enlace"
  13. set scplayingtrigger "!tocando"
  14. set sclistenertrigger "!oyentes"
  15. set scdjtrigger "!dj"
  16. set scsetdjtrigger ".serdj"
  17. set scunsetdjtrigger ".noserdj"
  18. set scwishtrigger "!pedidos"
  19. set scgreettrigger "!saludos"
  20. set sclastsongstrigger "!ultimas"
  21. set schelptrigger "!radio"
  22.  
  23.  
  24. set alertadmin ""
  25. set doalertadmin "1"
  26.  
  27. set announce "1"
  28.  
  29. set urltopic "0"
  30. set ctodjc "1"
  31. set tellsongs "1"
  32. set tellusers "1"
  33. set tellbitrate "1"
  34.  
  35. set advertise "6"
  36. set advertiseonlyifonline "1"
  37.  
  38. set offlinetext "1Radio Esta 3APAGADO 1No Insistas Porfavor!!!"
  39. set offlinetopic ""
  40.  
  41. set onlinetext "1Radio 3TRANSMITIENDO a 3/bitrate/ 1KBITS Sitonizanos en ==> 3ACA PONES LA WEB DE TU RADIO"
  42. set onlinetopic ""
  43.  
  44. set streamtext "1Sintoniza Radio en 3ACA PONES LA WEB DE TU RADIO"
  45.  
  46. set advertisetext "1Radio 3TRANSMITIENDO 1==> 3ACA PONES LA WEB DE TU RADIO 1Para ver los Comandos de la Radio Teclea 3!radio"
  47.  
  48.  
  49. # end of config #####################
  50.  
  51.  
  52. bind pub - $scstatstrigger pub_scstat
  53. bind msg - $scstatstrigger msg_scstat
  54.  
  55. bind pub - $scplayingtrigger pub_playing
  56. bind msg - $scplayingtrigger msg_playing
  57.  
  58. bind pub - $scdjtrigger pub_dj
  59. bind msg - $scdjtrigger msg_dj
  60.  
  61. bind pub D $scsetdjtrigger pub_setdj
  62. bind msg D $scsetdjtrigger msg_setdj
  63.  
  64. bind pub D $scunsetdjtrigger pub_unsetdj
  65. bind msg D $scunsetdjtrigger msg_unsetdj
  66.  
  67. bind pub - $scwishtrigger pub_wish
  68. bind msg - $scwishtrigger msg_wish
  69.  
  70. bind pub - $scgreettrigger pub_greet
  71. bind msg - $scgreettrigger msg_greet
  72.  
  73. bind pub - $scstreamtrigger pub_stream
  74. bind msg - $scstreamtrigger msg_stream
  75.  
  76. bind pub - $sclastsongstrigger pub_lastsongs
  77. bind msg - $sclastsongstrigger msg_lastsongs
  78.  
  79. bind pub - $sclistenertrigger pub_listener
  80. bind msg - $sclistenertrigger msg_listener
  81.  
  82. bind pub - $schelptrigger pub_help
  83. bind msg - $schelptrigger msg_help
  84.  
  85. bind time - "* * * * *" envivo
  86. bind time - "?0 * * * *" advertise
  87. bind nick f * djnickchange
  88.  
  89.  
  90. set dj ""
  91. set surl ""
  92. set bitrate ""
  93. set stitle ""
  94.  
  95. if {[file exists dj]} {
  96. set temp [open "dj" r]
  97. set dj [gets $temp]
  98. close $temp
  99. }
  100.  
  101. proc shrink { calc number string start bl} { return [expr [string first "$string" $bl $start] $calc $number] }
  102.  
  103.  
  104. proc status { } {
  105. global streamip streamport streampass
  106. if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
  107. putlog "error: $sockerror"
  108. return 0 } else {
  109. puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
  110. puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
  111. puts $sock "Host: $streamip"
  112. puts $sock "Connection: close"
  113. puts $sock ""
  114. flush $sock
  115. while {[eof $sock] != 1} {
  116. set bl [gets $sock]
  117. if { [string first "standalone" $bl] != -1 } {
  118. set streamstatus [string range $bl [shrink + 14 "<streamstatus>" 0 $bl] [shrink - 1 "</streamstatus>" 0 $bl]]
  119. }}
  120. close $sock
  121. }
  122. if { $streamstatus == "1" } { return 1 } else { return 0 }
  123. }
  124.  
  125.  
  126.  
  127.  
  128. proc poststuff { mode text } {
  129. global radiochans dj
  130. set curlist "0"
  131. set curhigh "0"
  132. set surl ""
  133. set cursong ""
  134. set sgenre ""
  135. set bitrate "0"
  136. set stitle ""
  137.  
  138. set temp [open "envivo" r]
  139. while {[eof $temp] != 1} {
  140. set zeile [gets $temp]
  141. if {[string first "curlist:" $zeile] != -1 } { set curlist $zeile }
  142. if {[string first "curhigh:" $zeile] != -1 } { set curhigh $zeile }
  143. if {[string first "cursong:" $zeile] != -1 } { set cursong [lrange $zeile 1 [llength $zeile]]] }
  144. if {[string first "sgenre:" $zeile] != -1 } { set sgenre [lrange $zeile 1 [llength $zeile]]}
  145. if {[string first "serverurl:" $zeile] != -1 } { set surl [lindex $zeile 1] }
  146. if {[string first "bitrate:" $zeile] != -1 } { set bitrate [lindex $zeile 1] }
  147. if {[string first "stitle:" $zeile] != -1 } { set stitle [lindex $zeile 1] }
  148. }
  149. close $temp
  150.  
  151. regsub -all "/stitle/" $text "$stitle" text
  152. regsub -all "/curlist/" $text "$curlist" text
  153. regsub -all "/curhigh/" $text "$curhigh" text
  154. regsub -all "/cursong/" $text "$cursong" text
  155. regsub -all "/sgenre/" $text "$sgenre" text
  156. regsub -all "/surl/" $text "$surl" text
  157. regsub -all "/bitrate/" $text "$bitrate" text
  158. regsub -all "/dj/" $text "$dj" text
  159.  
  160. foreach chan [channels] {
  161. if {$radiochans == "" } { putserv "$mode $chan :$text" }
  162. if {$radiochans != "" } {
  163. if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1)} {putserv "$mode $chan :$text"}
  164. }}}
  165.  
  166.  
  167. proc schelp { target } {
  168. global scstatstrigger scstreamtrigger scplayingtrigger scdjtrigger sclastsongstrigger scwishtrigger scgreettrigger sclistenertrigger
  169. putserv "notice $target :1Los Comandos que Puedes Usar Son: 3!enlace 1- 3!tocando 1- 3!oyentes 1- 3!ultimas 1- 3!dj 1- 3!estado"
  170. putserv "notice $target :4$scstatstrigger1: Ver el Estado - 4$scstreamtrigger1: Ver Nuestro Link - 4$scplayingtrigger1: Ver el SONG que esta - 4$scdjtrigactualmente Sonando ger1: Ver Nuestro Actual DJ de la Radio - 4$sclastsongstrigger1: Ver Las 10 ULTIMAS Song sonadas en radio - 4$scwishtrigger1: Mandar pedidos Musicales Ej: $scwishtrigger <tus_songs> - 4$scgreettrigger1: Mandar Tus Mensaje de Saludos Ej: $scgreettrigger <tus_saludos> 4$sclistenertrigger1: Ver N° Actual de Oyentes "
  171. putserv "notice $target :1Radio ==> 5ACA PONES LA WEB DE TU RADIO51"
  172. }
  173.  
  174.  
  175. proc pub_help {nick uhost hand chan arg} {
  176. global radiochans
  177. if {$radiochans == "" } { schelp $nick }
  178. if {$radiochans != "" } {
  179. if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { schelp $nick}
  180. }}
  181.  
  182. proc advertise { nick uhost hand chan arg } {
  183. global advertisetext advertise advertiseonlyifonline
  184. if {$advertise == "1" && $advertiseonlyifonline == "0"} { poststuff privmsg "$advertisetext" }
  185. if {$advertise == "1" && $advertiseonlyifonline == "1" && [status] == 1} { poststuff privmsg "$advertisetext" }
  186. }
  187.  
  188.  
  189. proc setdj {nickname djnickname } {
  190. if {$djnickname == "" } { set djnickname $nickname }
  191. global streamip streamport streampass dj
  192. putlog "shoutcast: Nuevo Dj: $djnickname ($nickname)"
  193. set temp [open "dj" w+]
  194. puts $temp $djnickname
  195. close $temp
  196. set temp [open "djnick" w+]
  197. puts $temp $nickname
  198. close $temp
  199. if { [status] == "1" } { poststuff privmsg "$djnickname Es Ahora Nuestro DJ."
  200. if { $::ctodjc == "1" } {
  201. set temp [open "envivo" r]
  202. while {[eof $temp] != 1} {
  203. set zeile [gets $temp]
  204. if {[string first "envivo:" $zeile] != -1 } { set oldenvivo $zeile }
  205. if {[string first "curlist:" $zeile] != -1 } { set oldcurlist $zeile }
  206. if {[string first "curhigh:" $zeile] != -1 } { set oldcurhigh $zeile }
  207. if {[string first "cursong:" $zeile] != -1 } { set oldsong $zeile }
  208. if {[string first "bitrate:" $zeile] != -1 } { set oldbitrate $zeile }
  209. }
  210. close $temp
  211. }
  212. } else {
  213. putserv "privmsg $nickname :Comando invalido por tener el servidor OFF Line" }
  214. }
  215.  
  216.  
  217. proc msg_setdj { nick uhost hand arg } { setdj $nick $arg }
  218. proc pub_setdj { nick uhost hand chan arg } { global adminchans; if {([lsearch -exact [string tolower $adminchans] [string tolower $chan]] != -1) || ($adminchans == "")} { setdj $nick $arg }}
  219.  
  220. proc unsetdj { nick } {
  221. global dj scsetdjtrigger
  222. set dj ""
  223. file delete dj
  224. putserv "notice $nick :Dj Borrado .. Puede Entrar otro Dj Poniendo el Comando $scsetdjtrigger Nickname"
  225. }
  226.  
  227.  
  228.  
  229. proc msg_unsetdj { nick uhost hand arg } { unsetdj $nick }
  230. proc pub_unsetdj { nick uhost hand chan arg } { global adminchans; if {([lsearch -exact [string tolower $adminchans] [string tolower $chan]] != -1) || ($adminchans == "")} { unsetdj $nick }}
  231.  
  232.  
  233. proc listener { target } {
  234. global streamip streamport streampass
  235. putlog "Radio: $target Pedido De Conteo de Oyentes"
  236. if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
  237. putlog "error: $sockerror"
  238. return 0 } else {
  239. puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
  240. puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
  241. puts $sock "Host: $streamip"
  242. puts $sock "Connection: close"
  243. puts $sock ""
  244. flush $sock
  245. while {[eof $sock] != 1} {
  246. set bl [gets $sock]
  247. if { [string first "standalone" $bl] != -1 } {
  248. set repl [string range $bl [shrink + 19 "<reportedlisteners>" 0 $bl] [shrink - 1 "</reportedlisteners>" 0 $bl]]
  249. set curhigh [string range $bl [shrink + 15 "<peaklisteners>" 0 $bl] [shrink - 1 "</peaklisteners>" 0 $bl]]
  250. set maxl [string range $bl [shrink + 14 "<maxlisteners>" 0 $bl] [shrink - 1 "</maxlisteners>" 0 $bl]]
  251. set avgtime [string range $bl [shrink + 13 "<averagetime>" 0 $bl] [shrink - 1 "</averagetime>" 0 $bl]]
  252. }}
  253. close $sock
  254. 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"
  255. }}
  256.  
  257. proc msg_listener { nick uhost hand arg } { listener $nick }
  258. proc pub_listener { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { listener $nick }}
  259.  
  260. proc wish { nick arg } {
  261. if {$arg == ""} { putserv "notice $nick :"; return 0}
  262. if { [status] == "1" } {
  263. set temp [open "djnick" r]
  264. set djnick [gets $temp]
  265. close $temp
  266. putserv "privmsg $djnick :PEDIDO MUSICAL: $arg de Parte de $nick"
  267. } else {
  268. putserv "notice $nick :" }
  269. }
  270.  
  271.  
  272. proc msg_wish { nick uhost hand arg } { wish $nick $arg }
  273. proc pub_wish { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { wish $nick $arg }}
  274.  
  275.  
  276.  
  277.  
  278. proc sclastsongs { target } {
  279. global streamip streamport streampass
  280. putlog "Radio: $target Pedidos las Song ultimas"
  281. if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
  282. putlog "error: $sockerror"
  283. return 0 } else {
  284. puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
  285. puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
  286. puts $sock "Host: $streamip"
  287. puts $sock "Connection: close"
  288. puts $sock ""
  289. flush $sock
  290. while {[eof $sock] != 1} {
  291. set bl [gets $sock]
  292. if { [string first "standalone" $bl] != -1 } {
  293. set songs [string range $bl [string first "<title>" $bl] [expr [string last "</title>" $bl] + 7]]
  294.  
  295. regsub -all "&#x3C;" $songs "<" songs
  296. regsub -all "&#x3E;" $songs ">" songs
  297. regsub -all "&#x26;" $songs "+" songs
  298. regsub -all "&#x22;" $songs "\"" songs
  299. regsub -all "&#x27;" $songs "'" songs
  300. regsub -all "&#xFF;" $songs "" songs
  301. regsub -all "<title>" $songs "(" songs
  302. regsub -all "</title>" $songs ")" songs
  303. regsub -all "<song>" $songs "" songs
  304. regsub -all "</song>" $songs " - " songs
  305. regsub -all "<playedat>" $songs "" songs
  306. regsub -all "</playedat>" $songs "" songs
  307. regsub -all {\d} $songs "" songs
  308.  
  309. regsub -all "&#xB4;" $songs "´" songs
  310. regsub -all "&#x96;" $songs "-" songs
  311. regsub -all "&#xF6;" $songs "ö" songs
  312. regsub -all "&#xE4;" $songs "ä" songs
  313. regsub -all "&#xFC;" $songs "ü" songs
  314. regsub -all "&#xD6;" $songs "Ö" songs
  315. regsub -all "&#xC4;" $songs "Ä" songs
  316. regsub -all "&#xDC;" $songs "Ü" songs
  317. regsub -all "&#xDF;" $songs "ß" songs
  318.  
  319.  
  320.  
  321. }}
  322. close $sock
  323. putserv "notice $target :$songs"
  324. }}
  325.  
  326.  
  327. proc msg_lastsongs { nick uhost hand arg } { sclastsongs $nick }
  328. proc pub_lastsongs { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { sclastsongs $nick }}
  329.  
  330.  
  331.  
  332. proc scstream { target } {
  333. global streamip streamport streamtext
  334. putlog "Radio: Informacion pedida por $target"
  335. putserv "notice $target :$streamtext"
  336. }
  337.  
  338. proc msg_stream { nick uhost hand arg } { scstream $nick }
  339. proc pub_stream { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scstream $nick }}
  340.  
  341. proc scgreet { nick arg } {
  342. if {$arg == ""} { putserv "notice $nick :"; return 0}
  343. if { [status] == "1" } {
  344. set temp [open "djnick" r]
  345. set djnick [gets $temp]
  346. close $temp
  347. putserv "privmsg $djnick :(Saludo) - $nick - $arg"
  348. } else {
  349. putserv "notice $nick :" }
  350. }
  351.  
  352.  
  353. proc msg_greet { nick uhost hand arg } { scgreet $nick $arg }
  354. proc pub_greet { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scgreet $nick $arg }}
  355.  
  356.  
  357.  
  358. proc djnickchange { oldnick uhost hand chan newnick } {
  359. set temp [open "djnick" r]
  360. set djnick [gets $temp]
  361. close $temp
  362. if {$oldnick == $djnick} {
  363. putlog "Radio: Cambia de Nick del Dj $oldnick -> $newnick"
  364. set temp [open "djnick" w+]
  365. puts $temp $newnick
  366. close $temp
  367. }}
  368.  
  369.  
  370.  
  371.  
  372.  
  373. proc dj { target } {
  374. global streamip streamport streampass dj
  375. putlog "Radio: $target pidio la Informacio de Dj"
  376. if {[status] == 1} {
  377. if {[file exists dj]} {
  378. set temp [open "dj" r]
  379. set dj [gets $temp]
  380. close $temp
  381. putserv "notice $target :Le Presento a 4$dj Nuestro(a) DJ de Radio"
  382. } else { putserv "notice $target :No hay ningun DJ seteado" }
  383. } else { putserv "notice $target :La Radio se encuentra OFF Line" }
  384. }
  385.  
  386.  
  387.  
  388.  
  389. proc msg_dj { nick uhost hand arg } { dj $nick"}
  390. proc pub_dj { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { dj $nick }}
  391.  
  392.  
  393.  
  394. proc scstat {target} {
  395. global streamip streamport streampass
  396. putlog "Radio: $target Pidio el Estado de la Radio"
  397. if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
  398. putlog "error: $sockerror"
  399. return 0 } else {
  400. puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
  401. puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
  402. puts $sock "Host: $streamip"
  403. puts $sock "Connection: close"
  404. puts $sock ""
  405. flush $sock
  406. while {[eof $sock] != 1} {
  407. set bl [gets $sock]
  408. if { [string first "standalone" $bl] != -1 } {
  409. set streamstatus [string range $bl [shrink + 14 "<streamstatus>" 0 $bl] [shrink - 1 "</streamstatus>" 0 $bl]]
  410. set repl [string range $bl [shrink + 19 "<reportedlisteners>" 0 $bl] [shrink - 1 "</reportedlisteners>" 0 $bl]]
  411. set curhigh [string range $bl [shrink + 15 "<peaklisteners>" 0 $bl] [shrink - 1 "</peaklisteners>" 0 $bl]]
  412. set currentl [string range $bl [shrink + 18 "<currentlisteners>" 0 $bl] [shrink - 1 "</currentlisteners>" 0 $bl]]
  413. set surl [string range $bl [shrink + 11 "<serverurl>" 0 $bl] [shrink - 1 "</serverurl>" 0 $bl]]
  414. set maxl [string range $bl [shrink + 14 "<maxlisteners>" 0 $bl] [shrink - 1 "</maxlisteners>" 0 $bl]]
  415. set bitrate [string range $bl [shrink + 9 "<bitrate>" 0 $bl] [shrink - 1 "</bitrate>" 0 $bl]]
  416. set stitle [string range $bl [shrink + 13 "<servertitle>" 0 $bl] [shrink - 1 "</servertitle>" 0 $bl]]
  417. set sgenre [string range $bl [shrink + 13 "<servergenre>" 0 $bl] [shrink - 1 "</servergenre>" 0 $bl]]
  418. if {$sgenre != ""} {set sgenre " ($sgenre)"}
  419. set avgtime [string range $bl [shrink + 13 "<averagetime>" 0 $bl] [shrink - 1 "</averagetime>" 0 $bl]]
  420. set irc [string range $bl [shrink + 5 "<irc>" 0 $bl] [shrink - 1 "</irc>" 0 $bl]]
  421. set icq [string range $bl [shrink + 5 "<icq>" 0 $bl] [shrink - 1 "</icq>" 0 $bl]]
  422. if {$icq == 0} { set icq "N/A" }
  423. set aim [string range $bl [shrink + 5 "<aim>" 0 $bl] [shrink - 1 "</aim>" 0 $bl]]
  424. set webhits [string range $bl [shrink + 9 "<webhits>" 0 $bl] [shrink - 1 "</webhits>" 0 $bl]]
  425. set streamhits [string range $bl [shrink + 12 "<streamhits>" 0 $bl] [shrink - 1 "</streamhits>" 0 $bl]]
  426. set version [string range $bl [shrink + 9 "<version>" 0 $bl] [shrink - 1 "</version>" 0 $bl]]
  427. if {$streamstatus == 1} {
  428. if {[file exists dj]} {
  429. set temp [open "dj" r]
  430. set dj [gets $temp]
  431. close $temp
  432. } else { set dj "none" }
  433. putserv "notice $target :Radio ESTA EN LINEA, en Shoutcast y Transmitiendo a $bitrate kbps, mas información en $surl"
  434. } else {
  435. putserv "notice $target :Radio Actualmente ESTA APAGADA, Mas información en ACA PONES LA WEB DE TU RADIO" }
  436. putserv "notice $target :La Capacidad maxima de oyentes es $maxl, Total de Oyentes En la Radio fue de $curhigh oyentes."
  437. putserv "notice $target :El tiempo promedio de escucha es de $avgtime segundos, La Radio tiene $webhits webhits y $streamhits streamhits."
  438. putserv "notice $target :Tu puedes contactarte en el IRC en el canal $irc, Via Internet."
  439. }}
  440. close $sock
  441. }}
  442.  
  443.  
  444. proc msg_scstat { nick uhost hand arg } { scstat $nick}
  445. proc pub_scstat { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scstat $nick }}
  446.  
  447.  
  448. proc playing {target} {
  449. global streamip streamport streampass dj
  450. putlog "Radio: $target pidio el titulo de la Song"
  451. if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
  452. putlog "error: $sockerror"
  453. return 0 } else {
  454. puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
  455. puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
  456. puts $sock "Host: $streamip"
  457. puts $sock "Connection: close"
  458. puts $sock ""
  459. flush $sock
  460. while {[eof $sock] != 1} {
  461. set bl [gets $sock]
  462. if { [string first "standalone" $bl] != -1 } {
  463. set streamstatus [string range $bl [shrink + 14 "<streamstatus>" 0 $bl] [shrink - 1 "</streamstatus>" 0 $bl]]
  464. set songtitle [string range $bl [shrink + 11 "<songtitle" 0 $bl] [shrink - 1 "" 0 $bl]]
  465. set songurl [string range $bl [shrink + 9 "<songurl>" 0 $bl] [shrink - 1 "</songurl>" 0 $bl]]
  466. if {$songurl != ""} { set songurl " ($songurl)"}
  467. regsub -all "&#x3C;" $songtitle "<" songtitle
  468. regsub -all "&#x3E;" $songtitle ">" songtitle
  469. regsub -all "&#x26;" $songtitle "+" songtitle
  470. regsub -all "&#x22;" $songtitle "\"" songtitle
  471. regsub -all "&#x27;" $songtitle "'" songtitle
  472. regsub -all "&#xFF;" $songtitle "" songtitle
  473. regsub -all "&#xB4;" $songtitle "´" songtitle
  474. regsub -all "&#x96;" $songtitle "-" songtitle
  475. regsub -all "&#xF6;" $songtitle "ö" songtitle
  476. regsub -all "&#xE4;" $songtitle "ä" songtitle
  477. regsub -all "&#xFC;" $songtitle "ü" songtitle
  478. regsub -all "&#xD6;" $songtitle "Ö" songtitle
  479. regsub -all "&#xC4;" $songtitle "Ä" songtitle
  480. regsub -all "&#xDC;" $songtitle "Ü" songtitle
  481. regsub -all "&#xDF;" $songtitle "ß" songtitle
  482.  
  483. if {$streamstatus == 1} {
  484. putserv "notice $target :Radio, Tocando ==> $songtitle"
  485. } else {
  486. putserv "notice $target :"
  487. }}}
  488. close $sock
  489. }}
  490.  
  491. proc msg_playing { nick uhost hand arg } { playing $nick}
  492. proc pub_playing { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { playing $nick }}
  493.  
  494.  
  495.  
  496. proc envivo { nick uhost hand chan arg } {
  497. global radiochans announce tellusers tellsongs tellbitrate urltopic dj
  498. global offlinetext offlinetopic onlinetext onlinetopic
  499. global streamip streampass streamport dj
  500. global doalertadmin alertadmin
  501.  
  502. if {$announce == 1 || $tellsongs == 1 || $tellusers == 1 || $tellbitrate == 1} {
  503. set envivofile "envivo"
  504. set oldenvivo "envivo: 0"
  505. set oldcurlist "curlist: 0"
  506. set oldcurhigh "curhigh: 0"
  507. set oldsong "cursong: 0"
  508. set oldbitrate "bitrate: 0"
  509. if {[file exists $envivofile]} {
  510. putlog "Radio: Viendo la Conexion de Radio"
  511. set temp [open "envivo" r]
  512. while {[eof $temp] != 1} {
  513. set zeile [gets $temp]
  514. if {[string first "envivo:" $zeile] != -1 } { set oldenvivo $zeile }
  515. if {[string first "curlist:" $zeile] != -1 } { set oldcurlist $zeile }
  516. if {[string first "curhigh:" $zeile] != -1 } { set oldcurhigh $zeile }
  517. if {[string first "cursong:" $zeile] != -1 } { set oldsong $zeile }
  518. if {[string first "bitrate:" $zeile] != -1 } { set oldbitrate $zeile }
  519. }
  520. close $temp
  521. }
  522.  
  523.  
  524. if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
  525. putlog "error: $sockerror"
  526. return 0} else {
  527. puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
  528. puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
  529. puts $sock "Host: $streamip"
  530. puts $sock "Connection: close"
  531. puts $sock ""
  532. flush $sock
  533. while {[eof $sock] != 1} {
  534. set bl [gets $sock]
  535. if { [string first "standalone" $bl] != -1 } {
  536. set streamstatus "envivo: [string range $bl [shrink + 14 "<streamstatus>" 0 $bl] [shrink - 1 "</streamstatus>" 0 $bl]]"
  537. set repl "curlist: [string range $bl [shrink + 19 "<reportedlisteners>" 0 $bl] [shrink - 1 "</reportedlisteners>" 0 $bl]]"
  538. set curhigh "curhigh: [string range $bl [shrink + 15 "<peaklisteners>" 0 $bl] [shrink - 1 "</peaklisteners>" 0 $bl]]"
  539. set currentl [string range $bl [shrink + 18 "<currentlisteners>" 0 $bl] [shrink - 1 "</currentlisteners>" 0 $bl]]
  540. set surl "serverurl: [string range $bl [shrink + 11 "<serverurl>" 0 $bl] [shrink - 1 "</serverurl>" 0 $bl]]"
  541. set cursong "cursong: [string range $bl [shrink + 11 "<songtitle" 0 $bl] [shrink - 1 "</songtitle>" 0 $bl]]"
  542. set songurl [string range $bl [shrink + 9 "<songurl>" 0 $bl] [shrink - 1 "</songurl>" 0 $bl]]
  543. set bitrate "bitrate: [string range $bl [shrink + 9 "<bitrate>" 0 $bl] [shrink - 1 "</bitrate>" 0 $bl]]"
  544. set stitle "stitle: [string range $bl [shrink + 13 "<servertitle>" 0 $bl] [shrink - 1 "</servertitle>" 0 $bl]]"
  545. set sgenre "sgenre: [string range $bl [shrink + 13 "<servergenre>" 0 $bl] [shrink - 1 "</servergenre>" 0 $bl]]"
  546. }}
  547. close $sock
  548. }
  549.  
  550. set temp [open "envivo" w+]
  551. puts $temp "$streamstatus\n$repl\n$curhigh\n$cursong\n$bitrate\n$stitle\n$sgenre\n$surl"
  552. close $temp
  553. if {$announce == 1 } {
  554. if {$streamstatus == "envivo: 0" && $oldenvivo == "envivo: 1"} {
  555. poststuff privmsg $offlinetext
  556. if {$doalertadmin == "1"} { sendnote domsen $alertadmin "" }
  557. if {$urltopic == 1} { poststuff topic $offlinetopic }
  558. }
  559. if {$streamstatus == "envivo: 1" && $oldenvivo == "envivo: 0" } {
  560. if {$sgenre != ""} {
  561. set sgenre " ([lrange $sgenre 1 [llength $sgenre]] )"
  562. }
  563. poststuff privmsg "$onlinetext"
  564. if {$urltopic == 1} { poststuff topic "$onlinetopic" }
  565. }}
  566. if {($tellusers == 1) && ($streamstatus == "envivo: 1") && ($oldcurhigh != "curhigh: 0") } {
  567. if {$oldcurhigh != $curhigh} {
  568. poststuff privmsg "Posibles Oyentes: [lindex $curhigh 1]"
  569. }
  570. if {$oldcurlist != $repl} {
  571. poststuff privmsg ""
  572. }}
  573. if {($tellsongs == 1) && ($oldsong != $cursong) && ($streamstatus == "envivo: 1") } {
  574. if {$songurl != ""} { set songurl " ($songurl)"}
  575. regsub -all "&#x3C;" $cursong "<" cursong
  576. regsub -all "&#x3E;" $cursong ">" cursong
  577. regsub -all "&#x26;" $cursong "+" cursong
  578. regsub -all "&#x22;" $cursong "\"" cursong
  579. regsub -all "&#x27;" $cursong "'" cursong
  580. regsub -all "&#xFF;" $cursong "" cursong
  581. regsub -all "&#xB4;" $cursong "´" cursong
  582. regsub -all "&#x96;" $cursong "-" cursong
  583. regsub -all "&#xF6;" $cursong "ö" cursong
  584. regsub -all "&#xE4;" $cursong "ä" cursong
  585. regsub -all "&#xFC;" $cursong "ü" cursong
  586. regsub -all "&#xD6;" $cursong "Ö" cursong
  587. regsub -all "&#xC4;" $cursong "Ä" cursong
  588. regsub -all "&#xDC;" $cursong "Ü" cursong
  589. regsub -all "&#xDF;" $cursong "ß" cursong
  590. putlog $cursong
  591. poststuff privmsg "1Quieres Escuchar Radio Haz Doble Click en ==> 3ACA PONES LA WEB DE TU RADIO 1En Linea 3$dj 1La Actual Canción es: 3[lrange $cursong 1 [llength $cursong]] 1Para ver los Comandos de la Radio Teclea 3!radio"
  592. }
  593.  
  594. if {($tellbitrate == 1) && ($oldbitrate != $bitrate) && ($streamstatus == "envivo: 1") && ($oldbitrate != "bitrate: 0")} {
  595. poststuff privmsg "Calidad Seteada a [lindex $bitrate 1]kbps"
  596. }}}
  597.  
  598. putlog "TCL de Radio"
Add Comment
Please, Sign In to add comment