Advertisement
Guest User

Untitled

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