Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.15 KB | None | 0 0
  1. alias -l icecast_config {
  2.   if (channel == $1) return #nativamix
  3.   if (timer == $1) return 10
  4.   if (server == $1) return 158.69.226.83
  5.   if (port == $1) return 9319
  6. }
  7.  
  8. alias icecast {
  9.   if (off == $1) {
  10.     if ($timer(icecast)) .timericecast off
  11.     if ($hget(icecast)) hfree icecast
  12.     if ($sock(icecast)) .sockclose icecast
  13.   }
  14.   else {
  15.     if (!$timer(icecast)) .timericecast 0 $icecast_config(timer) icecast
  16.     if ($sock(icecast)) .sockclose icecast
  17.     if (!$hget(icecast)) hmake icecast 4
  18.     sockopen icecast $icecast_config(server) $icecast_config(port)
  19.     sockmark icecast -n
  20.   }
  21. }
  22.  
  23. on *:SOCKOPEN:icecast:{
  24.   if ($sockerr) echo -s Erro ao conectar.
  25.   else sockwrite -t $sockname $+(GET /status.xsl HTTP/1.0,$crlf,Host: $sock($sockname).addr,$crlf,Connection: close,$crlf,$crlf)
  26. }
  27.  
  28. on *:SOCKREAD:icecast:{
  29.   set -l %mark
  30.   :a
  31.   %mark = $sock($sockname).mark
  32.   sockread %mark &read
  33.   if (!$sockbr) return
  34.   if (%mark) {
  35.     if (0 0 == $bvar(&read,1-)) sockmark $sockname
  36.     else {
  37.       tokenize 32 $bvar(&read,1-).text
  38.       if (HTTP/* iswm $1) hadd icecast get_HTTP $2-
  39.       elseif (Content-Length: == $1) hadd icecast get_Content-Length $2
  40.     }
  41.   }
  42.   else {
  43.     noop $hget(icecast,get_content,&content)
  44.     bcopy &content -1 &read 1 -1
  45.     hadd -b icecast get_content &content
  46.   }
  47.   goto a
  48. }
  49.  
  50. on *:SOCKCLOSE:icecast:{
  51.   set -l %amusica $hget(icecast,musica)
  52.   set -l %erro
  53.   if (200 OK != $hget(icecast,get_HTTP)) {
  54.     %erro = HTTP: $v2
  55.     goto erro
  56.   }
  57.   if ($hget(icecast,get_content,&content) != $hget(icecast,get_Content-Length)) {
  58.     %erro = Content != Content: $v1 != $v2
  59.     goto erro
  60.   }
  61.   set -l %ipos $bfind(&content,1,<h3 class="mount">Mount Point /live</h3>).text
  62.   %ipos = $bfind(&content,%ipos,<tr><td>Currently playing:</td><td class="streamstats">).text + 55
  63.   set -l %fpos $bfind(&content,%ipos,</td></tr>).text - %ipos
  64.   if (%fpos) {
  65.     hadd icecast musica $bvar(&content,%ipos,%fpos).text
  66.  
  67.     if (%amusica != $hget(icecast,musica)) msg $icecast_config(channel) Tocando agora na NativaMix: $v2
  68.   }
  69.  
  70.   :erro
  71.   if (%erro) {
  72.     echo -s Icecast Erro: %erro
  73.   }
  74.   hdel -w icecast get_*
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement