SHOUTcast Dialog

By DonCorleone on May 17, 2015

Always been looking for a script that shows the titles of your radio in your channel.
So wait no longer and put this script in your mirc and open the dialog after saving.

Then you put the IP/Url, Port and Password in the fields and click on the save button.
If you've done that you start mIRC again and wait for the titles in the channel.

alias -l kamer { return %radioroom }
; What is the IP/Adres from your SHOUTcast
alias -l shoutcast.ip { return %ipstream }
; What is the port from your SHOUTcast
alias -l shoutcast.poort { return %streamport }
; What is the admin password from your SHOUTcast
alias -l shoutcast.paswoord { return %streampasswd }
alias -l webradio { return shoutcast }
alias -l verkrijgxml {
var %tag.open = $+(<, $1, >)
var %tag.sluiten = $+(</, $1, >)
if ($pos($2-,%tag.open)) {
var %start = $ifmatch + $len(%tag.open)
var %lengte  = $calc($pos($2-, %tag.sluiten) - %start)
return $mid($2-, %start, %lengte)
}
return $null
}

on 1:SOCKOPEN:$($webradio): {
  sockwrite -n $sockname GET $+(/admin.cgi?pass=,$shoutcast.paswoord,&mode=viewxml HTTP/1.1)
  sockwrite -n $sockname Host: $+($shoutcast.ip, :, $shoutcast.poort)
  sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040614 Firefox/0.8
  sockwrite -n $sockname *.*, */*
  sockwrite -n $sockname Accept-Language: en-us,en;q=0.5
  sockwrite -n $sockname Accept-Encoding: gzip,deflate
  sockwrite -n $sockname Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  sockwrite -n $sockname Keep-Alive: 300
  sockwrite -n $sockname Connection: keep-alive
  sockwrite -n $sockname $crlf
}

on 1:SOCKREAD:$($webradio): {
  var %data
  sockread -f %data
  while (($sockbr > 0) && ($sockerr == 0)) {
  if ($verkrijgxml(SERVERTITLE, %data) != $null) {
  %servernaam = $ifmatch
}
  if ($verkrijgxml(CURRENTLISTENERS, %data) != $null) {
  %luisteraars = $ifmatch
}
  if ($verkrijgxml(SONGTITLE, %data) != $null) {
  %titel = $ifmatch
}
  if ($verkrijgxml(PEAKLISTENERS, %data) != $null) {
  %piekluisteraars = $ifmatch
}
  sockread -f %data
  }
}

on 1:SOCKCLOSE:$($webradio): {
  %nieuw = %titel
  %nieuweluisteraars = %luisteraars
  %nieuweservertitle = %servernaam
  %nieuwepiek = %piekluisteraars
  if (%nieuweservertitle != %oudeservertitle) { 
  /msg %streamroom Online DJ: %nieuweservertitle
  %oudeservertitle = %servernaam
  unset %nieuweservertitle
}

if (%nieuw != %oud) {
  /msg %streamroom Now Playing: $replace(%nieuw,$chr(38) $+ $chr(35) $+ 039 $+ $chr(59),$chr(39),$chr(38) $+ quot $+ $chr(59),$chr(34),$chr(38) $+ amp $+ $chr(59),$chr(38),&#8221;,$chr(34),&#x27;n,',&#8220;,$chr(34)) 
  %oud = %titel
  unset %nieuw
  }
}
alias webradiotimer { sockopen $webradio $shoutcast.ip $shoutcast.poort }

on *:connect:{
  .timerwebradio 0 30 /webradiotimer
}

alias ikke { /dialog -m streamdialog streamdialog }
dialog streamdialog {
size -1 -1 180 170
option dbu
title "SHOUTcast Dialog" 
button "Cancel" 1, 145 145 20 10,ok flat
edit "" 2, 62 10 90 10, autohs
text "IP/Adres:" 4, 15 10 45 10,
edit "" 3, 62 25 90 10, autohs
text "Port:" 5, 15 25 45 10, 
edit "" 6, 62 40 90 10, autohs
text "Admin Password:" 7, 15 40 45 10,
text "Stream Room:" 13, 15 55 45 10,
edit "" 15, 62 55 90 10, autohs
button "Save" 10, 25 90 30 10, flat
button "Clear" 20, 60 90 30 10, flat
}

on *:dialog:streamdialog:sclick:10:{
  if ($did($dname,2) == $null) { echo -a No IP/Adres entered }
  else {
  set %ipstream $did($dname,2)
  did -ra $dname 2 %ipstream
}
  if ($did($dname,3) == $null) { echo -a No port entered }
  else {
  set %streamport $did($dname,3)
  did -ra $dname 3 %streamport
}
  if ($did($dname,6) == $null) { echo -a No password Entered  }
  else {
  set %streampasswd $did($dname,6)
  did -ra $dname 6 %streampasswd
}
  if ($did($dname,15) == $null) { echo -a No Streamroom entered }
  else {
  set %streamroom $did($dname,15)
  did -ra $dname 15 %streamroom
}
  dialog -c streamdialog streamdialog
}

on *:dialog:streamdialog:init:*:{
  did -a $dname 2 %ipstream
  did -a $dname 3 %streamport
  did -a $dname 6 %streampasswd
  did -a $dname 15 %streamroom
}

menu query,nicklist,channel,menubar {
  SHOUTcast Dialog:/ikke
}   

Credits for current maker, I've only translated and shortened.
This script is written in Dutch but it is translated to English.

Comments

Sign in to comment.
dma   -  Nov 20, 2015

I just don't get this one????"?

 Respond  
alitee   -  Aug 24, 2015

o.o

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.