Simple Shoutcast Bot

By biase on Apr 14, 2016

A Simple Shoutcast Bot using $com.
This code will announce to channels will check the song name every 3 seconds and will announce the channels when the song changed.

;----------------------------------------------------------------------
; Author      : bruas aka biase @ Webchat & DalNet, Lite @ KampungChat
; Name        : Simple Shoutcast Bot
; URL         : -
; Description : A Simple Shoutcast Bot using $com.
; Setting     : Edit the variable %name, %station and %chans and make
;             : sure the station address end with /7.html
;----------------------------------------------------------------------

on *:connect: .timershoutcast. $+ $network 0 3 shoutcast

alias shoutcast {
  ;SETTING
  var %h 1, %name LTFM
  var %station http://lambattinggal.fm:8000/7.html
  var %chans #channel1 #channel2 #channel3 #AndSoOn
  ;END OF SETTING

  if (!$1) {
    var %a ajax. $+ $upper($regsubex($str(.,10),/./g,$mid($md5($time),$r(1,32),1)))
    .comopen %a msxml2.xmlhttp
    noop $comcall(%a,noop $com( %a ,open,1,bstr,GET,bstr, %station ,bool,true) $!com( %a ,ResponseText,2) $(|,) shoutcast $!com( %a ).result $(|,) .comclose %a,send,1)
    halt
  }
  tokenize 44 $regsubex($regsubex($1-,/<.+?>/g,),/&[#](\d+);/g,$chr(\1))
  if (!%nowplaying) || (%nowplaying != $md5($7)) {
    %nowplaying = $md5($7)
    while ($gettok(%chans,%h,32)) {
      msg $v1 $+(%name,:) $+($5,/,$4) Listener(s), $3 Peak Listeners, Now Playing: $7
      inc %h
    }
  }
}

Comments

Sign in to comment.
Grimnir   -  Jun 13, 2017

I needed users to be able to check what was on at random times so I added a little on text trigger:

on *:text:!nowplaying:#: {
tokenize 44 $regsubex($regsubex($1-,/<.+?>/g,),/&#;/g,$chr(\1))
%nowplaying = $md5($7)
}

I'm not sure I need the tokenize line in there line in there, but it doesn't seem to hurt anything.
I do need to figure out how to convert certain characters to be regular text and I suck at regex.
For example an apostrophe shows in the channel as ampersand pos semi-colon

Cool script though,
Thanks

biase  -  Nov 01, 2017

very wrong

Sign in to comment

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.