ShoutCast (socket only)

By Ayon on May 20, 2009

I only added the socket part here. But it should give you a pretty good idea on how to manipulate it to work the way you want it to.

make all the action happen inside *on :sockclose:ShoutCast:** :)

on *:sockopen:ShoutCast: {
  sockwrite -n $sockname GET /7.html HTTP/1.0
  sockwrite -n $sockname User-Agent: SHOUTcast Song Status (Mozilla  Compatible)
  sockwrite -n $sockname Host: $+(%sc.server,:,%sc.port)
  sockwrite -n $sockname Connection: keep-alive
  sockwrite -n $sockname $crlf
}
on *:sockread:ShoutCast: { 
  sockread -fn &bin 
  set %sc.all $bvar(&bin,1,150).text
  set %sc.info $remove(%sc.all,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html,>)
  set %sc.listen $gettok(%sc.info,1,44)
  set %sc.max $gettok(%sc.info,4,44)
  set %sc.peak $gettok(%sc.info,3,44)
  set %sc.kbps $gettok(%sc.info,6,44)
  set %sc.unique $gettok(%sc.info,5,44)
  set %sc.playing $gettok(%sc.info,7-,44)
  halt
}

Comments

Sign in to comment.
DragonHeart   -  Sep 29, 2010

Is there a way to grab the Last 10 songs played?

 Respond  
xplo   -  Mar 25, 2010

i <3

 Respond  
knoeki   -  Jul 17, 2009

Awesome! this helped me a lot :_)

 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.