Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

Now playing Radio Station (shoutcast based)

Recommended Posts

  • Administrators
Now Playing script for internet radio stations. It uses a SHOUTcast admin page for a givin station.

 

Commands:

 

!np or !nowplaying will show current song

 

!np [station name] [c,count,l,listner]

Shows current listner count.

 

!np [station name] url

will show the url of said site.

 

!np [station name] status

 

will show the current status of the stream [Online or Offline]

 

>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Now Playing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;v 2.1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;on $*:TEXT:/^(!?nowplaying|!np)/iS:#: {  ;;; Set up the station Information:  set %np_station SHOUTdrive  set %np_ip oontz.shoutdrive.com  set %np_port 80  set %np_url http://www.shoutdrive.com  set %np_nick $nick  set %np_chan $chan  sockclose nowplaying  sockopen nowplaying %np_ip %np_port  if ($3 != $null) {    if ($3 == s) || ($3 == status) set %np_3 status    if ($3 == url) set %np_3 url    if ($3 == c) || ($3 == count) || ($3 == listner) || ($3 == l) set %np_3 count  }}on *:SOCKOPEN:nowplaying:{  sockwrite -n $sockname GET /7.html HTTP/1.0  sockwrite -n $sockname User-Agent: Mozilla  sockwrite -n $sockname $crlf}on *:sockread:nowplaying:{  if ($sockerr > 0) {    notice %np_nick %tegn.1 $+ %radio.navn $+ %tegn.2 %tegn.midt %tegn.1 Stream Is Offline %tegn.2 NOTE1    return  }  :nextread  sockread -f %scasttemp1  if ($sockbr == 0) return  if (%scasttemp1 == $null) %scasttemp1 = empty  set %scasttemp1 $remove(%scasttemp1,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html>)  if ((HTTP/1.* !iswm %scasttemp1) && (content-type* !iswm %scasttemp1) && (%scasttemp1 != empty)) {    set %np_listeners1 $gettok(%scasttemp1,1,44)    set %np_status1 $gettok(%scasttemp1,2,44)    set %np_peak1 $gettok(%scasttemp1,3,44)    set %np_max1 $gettok(%scasttemp1,4,44)    set %np_ulistners1 $gettok(%scasttemp1,5,44)    set %np_kbps $gettok(%scasttemp1,6,44)    set %np_asong1 $gettok(%scasttemp1,7-,44)    set %np_song1 $replace(%np_asong1,&,$chr(38),',$chr(39))  }  goto nextread}on *:sockclose:nowplaying:{  ;=== Station Fail ====  ;-- If station is offline then:  if (%np_status1 == 0) {    msg %np_chan %np_station $+ : Stream Is Offline    goto np_end  }  ;=== User had added a 3rd parameter to their message. Aka !nowplaying [station] [s,status,url,c,count,listern]  ;-- If user has added an S or Status as the 3rd parameter. Then the status of station will show.  if (%np_3 == status) {    if (%np_status1 == 0) { var %np_status2 = Offline }    elseif (%np_status1 == 1) { var %np_status2 = Online }    msg %np_chan %np_station Status: %np_status2    ;msg %np_chan %np_station Status: %np_status2 $chr(124) Listeners: %np_listeners1 $chr(124) Peak: %np_peak1 $chr(124) Limit: $+ %np_max1 $chr(124) Stream: $+ %np_kbps $+ kbps  }  ;-- If user has URL as 3rd parameter, then url of site will show.  if (%np_3 == url) {    msg %np_chan %np_station $+ : %np_url  }  ;-- If user has C, Count, or L, then listener count will show.  if (%np_3 == count) {    msg %np_chan %np_station listener count: %np_listeners1 ( %np_ulistners1 unique )  }  ;-- IF user has only asked for !np, or !np [station], then the current song will show.  if (%np_3 == $null) {    msg %np_chan %np_station $+ : %np_song1  }  :np_end  unset %np_*}

Link to comment
Share on other sites



×
×
  • Create New...