Formatting of code : You can (and must) use [ tcl ] an [ /tcl ] tags (without spaces in tags) to format your TCL codes and have syntax coloration x


enlist radio tcl
#1
hi all, it's me once again. i hope all is well.


does anyone know a script to enlist radio station in both icecast & shoutcast?


example:

my radio is station is icecast, it requires the radio urlhttp://ip:port/stream  and the radio name is radio1
my other radio is station is shoutcast, it requires the radio urlhttp://ip:port/stream and the radio name is radio2


now what will i do in the script is to add their link;

RADIO1(icecast)

<user>!addradio radio1 http://ip:port/stream
<bot>Radio has been added to the list, type !radio1 for info.

<user>!radio1
[<bot>[Radio1] Now playing: Jim Croce - Time in a Bottle with 13 listeners


RADIO2 (shoutcast)
<user>!addradio radio2 http://ip:port/stream
<bot>Radio has been added to the list, type !radio2 for info.


<user>!radio2
<bot>[Radio2] Now playing: Jim Croce - Time in a Bottle with 13 listeners!




Now, if there are already more radios added or listed in the script, we can set a command by typing !radioinfo


<user>!radioinfo
<bot notice>Welcome to #RadioInfo ! Listed Radio Stations are as follows !
<bot notice>RadioInfo: !radio1 ( name of the radio station ) , !radio2 ( name of the radio station )





So, this script will be a service for all radio station who would like to be listed.







If anyone interested.. we can discuss it here..  :)
  Reply
#2
Your message is unreadable, you probably paste&copy parts from another forum. Can you remove useless tags from it please ?
irc.zeolia.net - Offrez-moi un café
Merci de ne pas demander d'aide en MP
  Reply
#3
hi CrazyCat, fixed it already.. :)
  Reply
#4
Thanks a lot, I'll patch the forum to avoid this kind of troubles tonight.

Back to the subject: I don't think a script able to manage the two streams is available, but it may be possible to do it.
Can you share your actuals script (shoutcast and icecast) to let us see the similarities and difference ?

In my mind, there is two ways to do that:
* simple one, having a command like !addradio <shoutcast | icecast> name feed_url
* more complex, the script auto-detects the radio type, but it means the streams have a distinguish element
irc.zeolia.net - Offrez-moi un café
Merci de ne pas demander d'aide en MP
  Reply
#5
I'll patch the forum to avoid this kind of troubles tonight. (yes please, thanks)



for icecast, this is what i found fro tclarchive;

tcl
#Tido's Modified Icecast2 Script
#Heavily Modified by Sircrazy
#Version 1.01
#July 12, 2010
######################################################################
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; version 2 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
######################################################################
#Credits:
#Influenced by Domsen's shoutcast1.03.tcl
#Special thanks to the TCL MAN files :D
#Special Release updated by Sircrazy
######################################################################
#Change these varibles to the one for your stream/bot/channel
 
#Name of Radio Station
set streamname "EDIT THIS"
 
#IP of the Icecast server.
set streamip "MAKE SURE IT IS THE IP"
 
#Port that Icecast is using, default is 8000.
set streamport "EDIT THIS"
 
#Main channel for the radio bot.
set radiochan "#EDIT THIS"
 
#Other channel that the bot can advertise to. Bot must be in this channel for this to work. Ice2.tcl only
# sends stream advertisements to this channel and does not send song info.
set otherchan "EDIT THIS OR REMOVE THIS TEXT"
 
#URL/Link to the stream for listening. This is what listeners need to click to tune in.
set streamurl "http://ssh.shellium.org/~sircrazy/sircrazy.m3u"
 
#How often the bot checks the stream when it knows it is down in minutes. Recommend 1 minute.
set offlinetimer "1"
 
#How often the bot checks the stream when it knows it is online in seconds. Recommend 15 seconds.
set onlinetimer "15"
 
#Default interval for how often the bot advertises (in minutes). You want to set it to something that isn't
# pure spammage.
set adtimer "30"
 
#Enables advertising set to the above frequency. 1 for ON and 0 for OFF. This reminds people that the stream
# is online.
set enableadvertise "1"
 
#Enables Special Announcement, 1 for ON and 0 for OFF. Special announcements are displayed every 720 minutes.
# This feature of the script is very undeveloped and I don't recommend using it.
set specialannounce "0"
 
#Special Announcement Message
set announcemsg "SPECIAL ANNOUNCEMENT! On Novemeber 26th @ Midnight GMT, JA Radio will be ON-AIR with a show featuring some exclusive live tracks from some of our favorite bands! Click here for more info: http://www.thejediacademy.net/forums_detail_page.php?f_id=13532"
 
###########################################################################
#  Don't edit past this stuff unless you're Tido, Henkes, or Sircrazy :P  #
#       Except Line 387 where you need to add DJs and Line 281 where      #
#                    you need to put your mount point.                    #
###########################################################################
 
 
# Binds
bind pub - "%commands" showcommands
#Shows a list of all commands
 
bind pub - "%help" showcommands
#same as %commands
 
bind pub - "%status" status
#Displays the status of the stream
 
bind pub - "%listeners" listenercheck
#Reports how many listeners there are
 
bind pub - "%request" request
#Allows users to request songs
 
bind msg - "request" request_pm
#Allows users to make requests via pm
 
bind msg - "djon" dj_on
#turns on dj status
 
bind pub - "%djoff" dj_off
#turns off dj status
 
bind msg - "djoff" dj_off_pm
#turns off dj status
 
bind pub - "%fadvert" forceadvertise
#Forces an advertising message to be sent
 
bind pub - "%version" iceversion
#Displays the Ice2.tcl version
 
# Varible Resets
set ice2version "1.01 - 07.12.10"
set streamstatus "0"
set djnickname ""
set dj ""
set oldsong ""
set newsong ""
set newlistener ""
set oldlistener "0"
set forceadsent "0"
set sessionpeak "0"
 
# Check to make sure StatusCheck timer isn't running when bot rehashes.
if {![info exists statuscheck_running]} {
  timer $offlinetimer [list statuscheck]
  set statuscheck_running 1
}
 
# Check to make sure Special Announce timer isn't running when bot rehashes.
if {![info exists specialannounce_running]} {
  if {$specialannounce == "1"} {
    timer 720 [list specialmessage]
    set specialannounce_running 1
  }
}
 
 
# Check to make sure Advertise timer isn't running when bot rehashes.
if {![info exists adtimer_running]} {
  if {$enableadvertise == "1"} {
    timer $adtimer [list advertise]
    set adtimer_running 1
  }
}
 
# Output for %help or %commands
proc showcommands {nick uhost hand chan arg} {
  global ice2version streamname botnick dj
  if {$dj == "$nick" && $arg != ""} {
    putserv "notice $arg :>>> $botnick Commands - $ice2version<<<"
    putserv "notice $arg :%status >>> Displays the stream's status. If online it shows the song."
    putserv "notice $arg :%request (artist+track) >>> Sends a Request for a future song."
    putserv "notice $arg :/msg $botnick request (artist+track) >>> Sends a Request for a future song by PM."
  }
  if {$dj != "$nick"} {
    set arg ""
    putserv "notice $nick :>>> $botnick Commands - $ice2version<<<"
    putserv "notice $nick :%status >>> Displays the stream's status. If online it shows the song."
    putserv "notice $nick :%request (artist+track) >>> Sends a Request for a future song."
    putserv "notice $nick :/msg $botnick request (artist+track) >>> Sends a Request for a future song by PM."
  }
}
 
# Turns on and off Advertising. Also lets you set the interval: !advertise X
proc toggle_advertise {nick uhost hand chan arg} {
  global radiochan enableadvertise adtimer
  if {$enableadvertise == "1"} {
    set enableadvertise "0"
    set timerinfo [gettimerid]
    killtimer $timerinfo
    putserv "PRIVMSG $chan :Advertising OFF"
  } else {
    set enableadvertise "1"
    if {$arg == ""} {
      putserv "PRIVMSG $chan :Advertising ON. Frequency set to $adtimer minutes."
    } else {
      set adtimer $arg
      putserv "privmsg $chan :Advertising ON. Frequency changed to $adtimer minutes."
      timer $adtimer [list advertise]
    }
  }
}
 
# Function that finds out the ID of the advertising timer.
proc gettimerid {} {
    set adtimerinfo [timers]
    set loc1 [string first "advertise" $adtimerinfo]
    set loc1 [expr $loc1 + 10]
    set str1 [string range $adtimerinfo $loc1 999]
    set endloc [string first "\}" $str1]
    set endloc [expr $endloc -1]
    set timerinfo [string range $str1 0 $endloc]
    return $timerinfo
}
 
# Messages that are displayed when Advertising is enabled.
proc advertise {} {
  global radiochan streamstatus otherchan enableadvertise adtimer forceadsent streamurl streamname
  if {$streamstatus != "0" && $enableadvertise == "1"} {
    putserv "PRIVMSG $radiochan :$streamname is currently broadcasting live! Listen in @ $streamurl"
    putserv "PRIVMSG $otherchan :$streamname is currently broadcasting live! Listen in @ $streamurl"
    if {$forceadsent == "0"} {timer $adtimer [list advertise]} else {set forceadsent "0"}
    return 1
  }
  return 0
}
 
# Forces the advertising messages to appear
proc forceadvertise {nick uhost hand chan arg} {
  global streamstatus enableadvertise forceadsent
  if {$streamstatus == "0"} {
    putserv "notice $nick :The stream isn't on-air. Unable to advertise."
    return 0
  } else {
    if {$enableadvertise == "0"} {
      putserv "notice $nick :Advertising isn't enabled."
      return 0
    } else {
      set forceadsent "1"
      set forceadvertised [advertise]
      if {$forceadvertised == "1"} {
        putserv "notice $nick :Done!"
      } else {
        putserv "notice $nick :Advertising message was not sent!"
      }
    }
  }
}
 
# Special Announcement Message.
proc specialmessage {} {
  global radiochan specialannounce announcemsg
  putserv "PRIVMSG $radiochan : $announcemsg"
  timer 720 [list specialmessage]
  return 0
}
 
# StatusCheck
# Function that takes the information from Icecast_Online and creates the proper responses.
proc statuscheck {} {
  global radiochan streamstatus newsong oldsong newlistener oldlistener sessionpeak dj enableadvertise otherchan onlinetimer offlinetimer streamurl streamname
 
  if {$streamstatus == "0"} {
    set oldstatus "0"
  } else {
    set oldstatus "1"
  }
  set newstatus "[icecast_online]"
  if {$newstatus =="0" && $oldstatus == "0"} {
    timer $offlinetimer [list statuscheck]
  }
  if {$newstatus == "1" && $oldstatus == "0"} {
    putserv "PRIVMSG $radiochan :$streamname is now ON-AIR!! Click to listen: $streamurl"
    putlog "(RADIO) On-Air detected."
    utimer $onlinetimer [list statuscheck]
    if {$enableadvertise == "1"} {
      putserv "PRIVMSG $otherchan :$streamname is now ON-AIR!! Click to listen: $streamurl"
 
    }
  }
  if {$newstatus == "0" && $oldstatus == "1"} {
    putserv "PRIVMSG $radiochan :$streamname is now off-air."
    set oldlistener "0"
    set sessionpeak "0"
    if {$enableadvertise == "1"} {
      putserv "PRIVMSG $otherchan :$streamname is now off-air."
    }
    putlog "(RADIO) Off-Air detected."
    timer $offlinetimer [list statuscheck]
  }
  if {$newstatus == "1" && $oldstatus == "1"} {
    utimer $onlinetimer [list statuscheck]
    if {$newsong != $oldsong && $newsong != ">inbetween" && $newsong != ">inbetween1" && $newsong != ">inbetween2" && $newsong != ">whatutalkinbout" && $newsong != ">tmsradio80sintro"} {
      putserv "PRIVMSG $radiochan :Now playing on $streamname: $newsong @ $streamurl"
      set oldsong "$newsong"
    }
  }
}
 
# Icecast_Online
# This is the HTTP Parser that gathers the various data from the status.xsl file.
proc icecast_online { } {
  global streamip streamport streamstatus newsong newlistener
  set pagedata ""
  if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
    putlog "error: $sockerror"
    return 0
  } else {
    puts $sock "GET /status.xsl?mount=/sircrazy HTTP/1.1"
    puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
    puts $sock "Host: $streamip"
    puts $sock "Connection: close"
    puts $sock ""
    flush $sock
    while {![eof $sock]} { append pagedata "[read $sock]" }
  }
  if {[string match *streamdata* $pagedata] == 1} {
    set streamstatus "1"
    set songlocation [string first "Current Song:" $pagedata]
    set songdata1 [string range $pagedata $songlocation 99999]
    set location2 [string first "</tr>" $songdata1]
    set songdata2 [string range $songdata1 0 $location2]
    set songdata3 [string range $songdata2 42 9999]
    set location3 [string first "</td>" $songdata3]
    set location3 [expr $location3 - 1]
    set newsong [string range $songdata3 0 $location3]
 
    set llocation [string first "Listeners:" $pagedata]
    set countdata1 [string range $pagedata $llocation 99999]
    set llocation2 [string first "</tr>" $countdata1]
    set countdata2 [string range $countdata1 0 $llocation2]
    set countdata3 [string range $countdata2 39 9999]
    set llocation3 [string first "</td>" $countdata3]
    set llocation3 [expr $llocation3 - 1]
    set newlistener [string range $countdata3 0 $llocation3]
    close $sock
    return 1
 
  } else {
    set streamstatus "0"
    close $sock
    return 0
  }
}
 
# %status function. Diplays the current status of the stream.
proc status {nick uhost hand chan arg} {
  global dj radiochan newsong newlistener streamstatus streamurl streamname
  if {$streamstatus == 1} {
    if {$newsong != "" &&  $dj == "$nick" && $arg != ""} {putserv "notice $arg :The current song is |$newsong| @ $streamurl"}
    if {$newsong != "" &&  $dj != "$nick"} {
      putserv "notice $nick :The current song is |$newsong| @ $streamurl"
    } 
  } else {putserv "notice $nick :$streamname is currently offline."
    }
}
 
# /msg %botnick listeners: displays how many current listeners there are.
proc listenercheck {nick uhost hand arg} {
  global newlistener radiochan streamstatus streamname
  if {$streamstatus == "1"} {
    if {$newlistener == "0"} {
      putserv "notice $nick :There aren't any listeners tuned into $streamname :(."
    } elseif {$newlistener =="1"} {
      putserv "notice $nick :There is 1 listener tuned into $streamname."
    } else {
      putserv "notice $nick :There are $newlistener listeners tuned into $streamname."
    }
  } else {
    putserv "notice $nick :$streamname isn't on-air."
  }
}
 
# %request: sends a message to dj about the request that was made.
proc request {nick uhost hand chan arg} {
  global dj
  if {$dj != ""} {
    if {$arg == ""} {putserv "notice $nick :You didn't request anything!"
    return 0
    } else {
      putserv "privmsg $dj :REQUEST($nick) => $arg"
      putserv "notice $nick :Your request was sent to $dj. Thank you!"
      return 0
      }
  } else {
    putserv "notice $nick :There is no DJ online taking requests."
    return 0
  }
}
 
# /msg $botnick request X: sends a message to dj about the request that was made.
proc request_pm {nick uhost hand arg} {
  global dj
  if {$dj != ""} {
    if {$arg == ""} {putserv "notice $nick :You didn't request anything!"
    return 0
    } else {
      putserv "privmsg $dj :REQUEST($nick) => $arg"
      putserv "notice $nick :Your request was sent to $dj. Thank you!"
      return 0
      }
  } else {
    putserv "notice $nick :There is no DJ online taking requests."
    return 0
  }
}
 
# /msg $botnick djon [password]: Turns DJ on for user
proc dj_on {nick uhost hand arg} {
  global dj radiochan
  if {$dj == ""} {
    if {$arg == ""} {putserv "privmsg $nick :You must enter your password"
      return 0
    } else {
# This is a Test DJ Entry. the $arg here is the password.
# You can have as many of these as you want, just paste
# them directly under one another, within the else { }.	
#      if {$arg == "Test"} {
#        set dj "$nick"
#        putserv "PRIVMSG $nick :You are logged in as $dj."
#        putserv "PRIVMSG $radiochan :$dj is now rocking the turntables and accepting requests via %request, enjoy."
#        return 0
#      }
    }
  }
  if {$dj != ""} {
    putsrv "notice $nick :$dj is already active. &dj needs to sign off before you can log in."
    return 0
  }
}
 
# %djoff: Turns DJ off for user
proc dj_off {nick uhost hand chan arg} {
  global dj radiochan
  if {$dj != $nick} {
    putserv "notice $nick :You are not the current DJ or you changed your nickname since becoming one."
  } else {
    putserv "PRIVMSG $radiochan :$dj is signing off and no longer accepting requests."
    set dj ""
    putserv "notice $nick :Your DJ'ness has been deactivated"
  }
}
 
# /msg $botnick djoff: Turns DJ off for user
proc dj_off_pm {nick uhost hand arg} {
  global dj radiochan
  if {$dj != $nick} {
    putserv "notice $nick :You are not the current DJ or you changed your nickname since becoming one."
  } else {
    putserv "PRIVMSG $radiochan :$dj is signing off and no longer accepting requests."
    set dj ""
    putserv "notice $nick :Your DJ'ness has been deactivated"
  }
}
 
# !version: displays the current version of the Ice2.tcl script.
proc iceversion {nick host hand chan arg} {
   global ice2version radiochan botnick
   if {$chan == $radiochan} {
     putserv "notice $nick :I am $botnick running Ice2.tcl Version $ice2version by Tido, Henkes, and Sircrazy."
   }
}
 
putlog "Ice2 Version $ice2version by Tido, Henkes, and Sircrazy is loaded! :)"




and for shoutcast;

tcl
# shoutcast.tcl v1.03 by domsen <domsen@domsen.org> (c)2oo5
#
# comments? bugs? ideas? requests? money? beer? 
# plz mail me or visit my homepage @ www.domsen.org
# visit #newsticker@ircnet
#
#
# whats this script all about?
# -----------------------------
#
# this script is for all the online radio admins out there. it announces serveral
# stuff like the status of your radio, the current song, new listener peaks,
# the current listeners and much much more to the channels you want.
# the users can get infos by public and msg command, too, like the stream url,
# stream stats, the last played songs, the current song, the dj... and much much
# more.
# also the bot informs the users about the current dj, whenever he changes or
# a certain command is triggered. the dj name doesnt need to be your nickname,
# so you can also call yourself "goethe mc" even if your irc nickname is
# [gay]michael. the good thing about this is: nobody knows your nickname, so 
# you wont get unwanted querys with wishes and greets. the dj can also change
# his nickname and the wish- and greet-feature will still work fine.
# only users with the flag +D can be djs, so make sure to give this flag to
# your djs -> .chattr djnick +D in the partyline.
# 
# the script also changes the topic when your stream goes on or offline and
# sends a public message, which is fully costumizeable. try it out yourself
# and maybe it suits your needs :)
#
# it was tested with shoutcast 1.9.2 on debian linux.
#
# NOTE 1: make sure youve got a good connection from your shellserver to your
# streamserver - if its the same server then thats very very good. the bot
# checks every minute if something happened, so if the connection is not fast
# the bot will lag like hell or timeout. make sure to change your settings
# for the eggdrop floodprotection.
#
# NOTE 2: read the text here carefully, i get many many emails asking questions
# which are acutally answered in this manual here. dont expect me to answer
# these mails. :P
#
#
# script history:
# ----------------
#
# v1.03 - different variables in the texts/topics possible
#       - possibility to unset the dj
#	- splitted the scripts chans in 'radiochans' and 'adminchans'
#	- 'advertiseonlyifonline'-function
#	- possibility to get a msg if the bot goes down
#	- more regexes
#	- some bugfixes 
# v1.02 - added the .listener command, corrected some typos ;>
# v1.01 - fixed a string i forgot to replace
# v1.0  - first public release
#
#
#
# what does what config option mean/do?
# --------------------------------------
#
# radiochans - the channels the tcl is active in, "" for all, or "#chan1 #chan2"
# adminchans - the channels the admin commands work in
#
# streamip - the ip of your radio
# streamport - the port of your radio
# streampass - the admin pass of your radio
#
# scstatstrigger - the trigger for the radio stats
# scplayingtrigger - shows the song the radio is playing now
# sclistenertrigger - shows the current listenercount
# scdjtrigger - shows the current dj name
# scstreamtrigger - shows your stream url -> streamtext
# scsetdjtrigger - sets the current dj name, this doesnt have to be your nickname.
#                  your nick will be saved too and all wishes and greets will be
#                  redirected to this nickname. only availavle for ppl with the +D
#                  flag.
# scunsetdjtrigger - unsets the current dj, needs the +D flag
# scwishtrigger - the command which the users can use if they wish a certain song
# scgreettrigger - the command which users can use if the want to greet sb
# sclastsongstrigger - the commands which users can use if they want to see the
#                      songhistory
# schelptrigger - shows the available commands
#
# alertadmin - the userhandle of the user who will get a msg if the server goes down
# doalertadmin - 1 if you want to get a msg if the server goes offline, 0 if you
#		 dont. this is done through the bots notes system because its
#		 more comfortable and persistent this way.
#
# announce - shall the bot announce any stuff? 1 for yes, 0 for no
# urltopic - shall the bot change the topic everytime the radio goes on or off?
# tellsongs - shall the bot post the songtitle to the channels everytime a
#             new song starts?
# tellusers - shall the bot post the number of current users to the channel
#             everytime it changes or a new user maximum is reached?
# tellbitrate - shall the bot announce bitrate changes?
#
# offlinetext - the reason the bot says when the radio goes offline
# offlinetopic - the topic which is set when the radio goes offline
#
# onlinetext - the reason the bot says when the radio goes online
# onlinetopic - the topic which is set when the radio goes online
#
# streamtext - the text with your stream infos
# advertise - shall the bot advertist the advertisetext?
# advertiseonlyifonline - 1 if the bot only should advertise the radio if the stream
#			  is up and running, 0 for all-the-time advertisement
# advertisetext - the text the bot will post once every 10 minutes.
#
#
#
# how do i put veriables in the different texts and topics?
# ----------------------------------------------------------
#
# the script knows the following variables which can be used in the offlinetext,
# offlinetopic, onlinetext, onlinetopic, streamtext and advertisetext:
# 
# /dj/ - the djnickname
# /sgenre/ - the servers music genre
# /stitle/ - the streamtitle
# /surl/ - the servers url
# /bitrate/ - the current streaming bitrate
# /curlist/ - current listeners
# /curhigh/ - current listener peak
# /cursong/ - the current song
# $streamip - the streams ip
# $streamport - the streams port
# 
#
#
# known bugs:
# ------------
#
# -numbers in the songhistory are killed, this is a xml sourcecode problem
# -צה are not shown correctly in the songtitles, because xml replaces each
#  of them with the same chars, so i cant fix it :( bitnapper told me it
#  would work anyway, but i cant confirm it. maybe my shoutcast version sucks.
#  the string replacements are included, so if it works youre a lucky guy.
#
#
# loser of the day:
# ------------------
#
# loops aka edema for ripping the whole script, removing all of my copyright
# infos and comments and putting his name under it. yeah, thats the open source
# spirit...
#
#
#
# config ##########################
 
set radiochans ""
set adminchans ""
set streamip ""
set streamport "8000"
set streampass ""
set scstatstrigger ".stats"
set scstreamtrigger ".stream"
set scplayingtrigger ".playing"
set sclistenertrigger ".listener"
set scdjtrigger ".dj"
set scsetdjtrigger ".setdj"
set scunsetdjtrigger ".unsetdj"
set scwishtrigger ".wish"
set scgreettrigger ".greet"
set sclastsongstrigger ".lastsongs"
set schelptrigger ".help"
 
set alertadmin ""
set doalertadmin "1"
 
set announce "1"
 
set urltopic "1"
set ctodjc "1"
set tellsongs "1"
set tellusers "1"
set tellbitrate "1"
 
set advertise "1"
set advertiseonlyifonline "1"
 
set offlinetext "going offline now"
set offlinetopic "visit our website @ www.domsen.org"
 
set onlinetext "/stitle/ now online @ /surl/ with /bitrate/kbits"
set onlinetopic "/dj/@/stitle/ @ /surl/ streaming at /bitrate/kbits"
 
set streamtext "tune in /dj/ @ http://$streamip:$streamport/listen.pls"
 
set advertisetext "stream @ http://$streamip:$streamport/listen.pls - powered by www.domsen.org"
 
# end of config #####################
 
bind pub - $scstatstrigger  pub_scstat
bind msg - $scstatstrigger  msg_scstat
 
bind pub - $scplayingtrigger  pub_playing
bind msg - $scplayingtrigger  msg_playing
 
bind pub - $scdjtrigger  pub_dj
bind msg - $scdjtrigger  msg_dj
 
bind pub D $scsetdjtrigger  pub_setdj
bind msg D $scsetdjtrigger  msg_setdj
 
bind pub D $scunsetdjtrigger  pub_unsetdj
bind msg D $scunsetdjtrigger  msg_unsetdj
 
bind pub - $scwishtrigger  pub_wish
bind msg - $scwishtrigger  msg_wish
 
bind pub - $scgreettrigger  pub_greet
bind msg - $scgreettrigger  msg_greet
 
bind pub - $scstreamtrigger pub_stream
bind msg - $scstreamtrigger msg_stream
 
bind pub - $sclastsongstrigger pub_lastsongs
bind msg - $sclastsongstrigger msg_lastsongs
 
bind pub - $sclistenertrigger pub_listener
bind msg - $sclistenertrigger msg_listener
 
bind pub - $schelptrigger pub_help
bind msg - $schelptrigger msg_help
 
bind time - "* * * * *" isonline
bind time - "?0 * * * *" advertise
bind nick D * djnickchange
 
 
set dj ""
set surl ""
set bitrate ""
set stitle ""
 
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
}
 
proc shrink { calc number string start bl} { return [expr [string first "$string" $bl $start] $calc $number] }
 
 
proc status { } {
global streamip streamport streampass
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus [string range $bl [shrink + 14 "<STREAMSTATUS>" 0 $bl] [shrink - 1 "</STREAMSTATUS>" 0 $bl]]
}}
close $sock
} 
if { $streamstatus == "1" } { return 1 } else { return 0 }
}
 
 
 
 
proc poststuff { mode text } {
global radiochans dj
set curlist "0"
set curhigh "0"
set surl ""
set cursong ""
set sgenre ""
set bitrate "0"
set stitle ""
 
set temp [open "isonline" r]
while {[eof $temp] != 1} {
set zeile [gets $temp]
if {[string first "curlist:" $zeile] != -1 } { set curlist $zeile }
if {[string first "curhigh:" $zeile] != -1 } { set curhigh $zeile }
if {[string first "cursong:" $zeile] != -1 } { set cursong [lrange $zeile 1 [llength $zeile]]] }
if {[string first "sgenre:" $zeile] != -1 } { set sgenre [lrange $zeile 1 [llength $zeile]]}
if {[string first "serverurl:" $zeile] != -1 } { set surl [lindex $zeile 1] }
if {[string first "bitrate:" $zeile] != -1 } { set bitrate [lindex $zeile 1] }
if {[string first "stitle:" $zeile] != -1 } { set stitle [lindex $zeile 1] }
}
close $temp
 
regsub -all "/stitle/" $text "$stitle" text
regsub -all "/curlist/" $text "$curlist" text
regsub -all "/curhigh/" $text "$curhigh" text
regsub -all "/cursong/" $text "$cursong" text
regsub -all "/sgenre/" $text "$sgenre" text
regsub -all "/surl/" $text "$surl" text
regsub -all "/bitrate/" $text "$bitrate" text
regsub -all "/dj/" $text "$dj" text
 
foreach chan [channels] {
if {$radiochans == "" } { putserv "$mode $chan :$text" }
if {$radiochans != "" } {
if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1)} {putserv "$mode $chan :$text"}
}}}
 
 
proc schelp { target } {
global scstatstrigger scstreamtrigger scplayingtrigger scdjtrigger sclastsongstrigger scwishtrigger scgreettrigger sclistenertrigger
putserv "notice $target :the following commands are available:"
putserv "notice $target :$scstatstrigger - $scstreamtrigger - $scplayingtrigger - $scdjtrigger - $sclastsongstrigger - $scwishtrigger - $scgreettrigger - $sclistenertrigger"
putserv "notice $target :shoutcast.tcl by domsen <domsen@domsen.org>"
}
 
proc pub_help {nick uhost hand chan arg} {
global radiochans
if {$radiochans == "" } { schelp $nick }
if {$radiochans != "" } {
if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { schelp $nick}
}}
 
proc advertise { nick uhost hand chan arg } {
global advertisetext advertise advertiseonlyifonline
if {$advertise == "1" && $advertiseonlyifonline == "0"} { poststuff privmsg "$advertisetext" }
if {$advertise == "1" && $advertiseonlyifonline == "1" && [status] == 1} { poststuff privmsg "$advertisetext" }
}
 
 
proc setdj {nickname djnickname } {
if {$djnickname == "" } { set djnickname $nickname }
global streamip streamport streampass dj 
putlog "shoutcast: new dj: $djnickname ($nickname)"
set temp [open "dj" w+]
puts $temp $djnickname
close $temp
set temp [open "djnick" w+]
puts $temp $nickname
close $temp
if { [status] == "1" } { poststuff privmsg "$djnickname is now rocking the turntables, enjoy."
if { $ctodjc == "1" } {
set temp [open "isonline" r]
while {[eof $temp] != 1} {
set zeile [gets $temp]
if {[string first "isonline:" $zeile] != -1 } { set oldisonline $zeile }
if {[string first "curlist:" $zeile] != -1 } { set oldcurlist $zeile }
if {[string first "curhigh:" $zeile] != -1 } { set oldcurhigh $zeile }
if {[string first "cursong:" $zeile] != -1 } { set oldsong $zeile }
if {[string first "bitrate:" $zeile] != -1 } { set oldbitrate $zeile }
}
close $temp
}
} else {
putserv "privmsg $nickname :this has not been announced because the radio is currentlfy offline." }
}
 
 
proc msg_setdj { nick uhost hand arg } { setdj $nick $arg }
proc pub_setdj { nick uhost hand chan arg } { global adminchans; if {([lsearch -exact [string tolower $adminchans] [string tolower $chan]] != -1) || ($adminchans == "")} { setdj $nick $arg }}
 
proc unsetdj { nick } {
global dj
set dj ""
file delete dj
putserv "notice $nick :dj deleted"
}
 
 
 
proc msg_unsetdj { nick uhost hand arg } { unsetdj $nick }
proc pub_unsetdj { nick uhost hand chan arg } { global adminchans; if {([lsearch -exact [string tolower $adminchans] [string tolower $chan]] != -1) || ($adminchans == "")} { unsetdj $nick }}
 
 
proc listener { target } {
global streamip streamport streampass
putlog "shoutcast: $target requested listener count"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set repl [string range $bl [shrink + 19 "<REPORTEDLISTENERS>" 0 $bl] [shrink - 1 "</REPORTEDLISTENERS>" 0 $bl]]
set curhigh [string range $bl [shrink + 15 "<PEAKLISTENERS>" 0 $bl] [shrink - 1 "</PEAKLISTENERS>" 0 $bl]]
set maxl [string range $bl [shrink + 14 "<MAXLISTENERS>" 0 $bl] [shrink - 1 "</MAXLISTENERS>" 0 $bl]]
set avgtime [string range $bl [shrink + 13 "<AVERAGETIME>" 0 $bl] [shrink - 1 "</AVERAGETIME>" 0 $bl]]
}}
close $sock
putserv "notice $target :there are currently $repl unique people listening, the listener maximum is $maxl, our user peak was at $curhigh listeners, the listening time average is $avgtime"
}}
 
proc msg_listener { nick uhost hand arg } { listener $nick }
proc pub_listener { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { listener $nick  }}
 
proc wish { nick arg } {
if {$arg == ""} { putserv "notice $nick :you forgot to add your wish"; return 0}
if { [status] == "1" } { 
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $djnick :(WISH) - $nick - $arg"
} else {
putserv "notice $nick :sorry radio is currently offline" }
}
 
 
proc msg_wish { nick uhost hand arg } { wish $nick $arg }
proc pub_wish { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { wish $nick $arg }}
 
 
 
 
proc sclastsongs { target } {
global streamip streamport streampass
putlog "shoutcast: $target requested songhistory"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set songs [string range $bl [string first "<TITLE>" $bl] [expr [string last "</TITLE>" $bl] + 7]]
 
regsub -all "&#x3C;" $songs "<" songs
regsub -all "&#x3E;" $songs ">" songs
regsub -all "&#x26;" $songs "+" songs
regsub -all "&#x22;" $songs "\"" songs
regsub -all "&#x27;" $songs "'" songs
regsub -all "&#xFF;" $songs "" songs
regsub -all "<TITLE>" $songs "(" songs
regsub -all "</TITLE>" $songs ")" songs
regsub -all "<SONG>" $songs "" songs
regsub -all "</SONG>" $songs " - " songs
regsub -all "<PLAYEDAT>" $songs "" songs
regsub -all "</PLAYEDAT>" $songs "" songs
regsub -all {\d} $songs "" songs
 
regsub -all "&#xB4;" $songs "´" songs
regsub -all "&#x96;" $songs "-" songs
regsub -all "&#xF6;" $songs "צ" songs
regsub -all "&#xE4;" $songs "ה" songs
regsub -all "&#xFC;" $songs "" songs
regsub -all "&#xD6;" $songs "ײ" songs
regsub -all "&#xC4;" $songs "ִ" songs
regsub -all "&#xDC;" $songs "" songs
regsub -all "&#xDF;" $songs "" songs
 
 
 
}}
close $sock
putserv "notice $target :$songs"
}}
 
 
proc msg_lastsongs { nick uhost hand arg } { sclastsongs $nick }
proc pub_lastsongs { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { sclastsongs $nick }}
 
 
 
proc scstream { target } {
global streamip streamport streamtext
putlog "shoutcast: streaminfo requested by $target"
putserv "notice $target :$streamtext"
}
 
proc msg_stream { nick uhost hand arg } { scstream $nick }
proc pub_stream { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scstream $nick }}
 
proc scgreet { nick arg } {
if {$arg == ""} { putserv "notice $nick :you forgot to add your greetmessage"; return 0}
if { [status] == "1" } { 
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
putserv "privmsg $djnick :(GREET) - $nick - $arg"
} else {
putserv "notice $nick :sorry radio is currently offline" }
}
 
 
proc msg_greet { nick uhost hand arg } { scgreet $nick $arg }
proc pub_greet { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scgreet $nick $arg }}
 
 
 
proc djnickchange { oldnick uhost hand chan newnick } {
set temp [open "djnick" r]
set djnick [gets $temp]
close $temp
if {$oldnick == $djnick} {
putlog "shoutcast: dj nickchange $oldnick -> $newnick"
set temp [open "djnick" w+]
puts $temp $newnick
close $temp
}}
 
 
 
 
 
proc dj { target } {
global streamip streamport streampass dj
putlog "shoutcast: $target asked for dj info" 
if {[status] == 1} {
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
putserv "notice $target :$dj is at the turntables!"
} else { putserv "notice $target :sorry, no dj name available" }
} else { putserv "notice $target :sorry radio is currently offline" }
}
 
 
 
proc msg_dj { nick uhost hand arg } { dj $nick"}
proc pub_dj { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { dj $nick  }}
 
 
 
proc scstat {target} {
global streamip streamport streampass
putlog "shoutcast: $target asked for serverstats"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus [string range $bl [shrink + 14 "<STREAMSTATUS>" 0 $bl] [shrink - 1 "</STREAMSTATUS>" 0 $bl]]
set repl [string range $bl [shrink + 19 "<REPORTEDLISTENERS>" 0 $bl] [shrink - 1 "</REPORTEDLISTENERS>" 0 $bl]]
set curhigh [string range $bl [shrink + 15 "<PEAKLISTENERS>" 0 $bl] [shrink - 1 "</PEAKLISTENERS>" 0 $bl]]
set currentl [string range $bl [shrink + 18 "<CURRENTLISTENERS>" 0 $bl] [shrink - 1 "</CURRENTLISTENERS>" 0 $bl]]
set surl [string range $bl [shrink + 11 "<SERVERURL>" 0 $bl] [shrink - 1 "</SERVERURL>" 0 $bl]]
set maxl [string range $bl [shrink + 14 "<MAXLISTENERS>" 0 $bl] [shrink - 1 "</MAXLISTENERS>" 0 $bl]]
set bitrate [string range $bl [shrink + 9 "<BITRATE>" 0 $bl] [shrink - 1 "</BITRATE>" 0 $bl]]
set stitle [string range $bl [shrink + 13 "<SERVERTITLE>" 0 $bl] [shrink - 1 "</SERVERTITLE>" 0 $bl]]
set sgenre [string range $bl [shrink + 13 "<SERVERGENRE>" 0 $bl] [shrink - 1 "</SERVERGENRE>" 0 $bl]]
if {$sgenre != ""} {set sgenre " ($sgenre)"}
set avgtime [string range $bl [shrink + 13 "<AVERAGETIME>" 0 $bl] [shrink - 1 "</AVERAGETIME>" 0 $bl]]
set irc [string range $bl [shrink + 5 "<IRC>" 0 $bl] [shrink - 1 "</IRC>" 0 $bl]]
set icq [string range $bl [shrink + 5 "<ICQ>" 0 $bl] [shrink - 1 "</ICQ>" 0 $bl]]
if {$icq == 0} { set icq "N/A" }
set aim [string range $bl [shrink + 5 "<AIM>" 0 $bl] [shrink - 1 "</AIM>" 0 $bl]]
set webhits [string range $bl [shrink + 9 "<WEBHITS>" 0 $bl] [shrink - 1 "</WEBHITS>" 0 $bl]]
set streamhits [string range $bl [shrink + 12 "<STREAMHITS>" 0 $bl] [shrink - 1 "</STREAMHITS>" 0 $bl]]
set version [string range $bl [shrink + 9 "<VERSION>" 0 $bl] [shrink - 1 "</VERSION>" 0 $bl]]
if {$streamstatus == 1} {
if {[file exists dj]} {
set temp [open "dj" r]
set dj [gets $temp]
close $temp
} else { set dj "none" }
putserv "notice $target :$stitle$sgenre is online, running shoutcast $version and streaming at $bitrate kbps,  your dj is $dj. please visit $surl"
} else {
putserv "notice $target :$stitle$sgenre is currenty offline, running shoutcast $version and streaming at $bitrate kbps, check out $surl" }
putserv "notice $target :there are currently $repl unique people listening, the listener maximum is $maxl, our user peak was at $curhigh listeners."
putserv "notice $target :the average user is listening $avgtime seconds, our stream had $webhits webhits and $streamhits streamhits."
putserv "notice $target :you can contact the team by irc on $irc, via aim at $aim and with icq by the uin $icq."
}}
close $sock
}}
 
 
proc msg_scstat { nick uhost hand arg } { scstat $nick}
proc pub_scstat { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { scstat $nick  }}
 
 
proc playing {target} {
global streamip streamport streampass dj
putlog "shoutcast: $target asked for current song"
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus [string range $bl [shrink + 14 "<STREAMSTATUS>" 0 $bl] [shrink - 1 "</STREAMSTATUS>" 0 $bl]]
set songtitle [string range $bl [shrink + 11 "<SONGTITLE" 0 $bl] [shrink - 1 "</SONGTITLE>" 0 $bl]]
set songurl [string range $bl [shrink + 9 "<SONGURL>" 0 $bl] [shrink - 1 "</SONGURL>" 0 $bl]]
if {$songurl != ""} { set songurl " ($songurl)"}
regsub -all "&#x3C;" $songtitle "<" songtitle
regsub -all "&#x3E;" $songtitle ">" songtitle
regsub -all "&#x26;" $songtitle "+" songtitle  
regsub -all "&#x22;" $songtitle "\"" songtitle
regsub -all "&#x27;" $songtitle "'" songtitle
regsub -all "&#xFF;" $songtitle "" songtitle
regsub -all "&#xB4;" $songtitle "´" songtitle
regsub -all "&#x96;" $songtitle "-" songtitle
regsub -all "&#xF6;" $songtitle "צ" songtitle
regsub -all "&#xE4;" $songtitle "ה" songtitle
regsub -all "&#xFC;" $songtitle "" songtitle
regsub -all "&#xD6;" $songtitle "ײ" songtitle
regsub -all "&#xC4;" $songtitle "ִ" songtitle
regsub -all "&#xDC;" $songtitle "" songtitle
regsub -all "&#xDF;" $songtitle "" songtitle
 
if {$streamstatus == 1} {
putserv "notice $target :now playing $songtitle$songurl"
} else {
putserv "notice $target :server is currently offline, sorry"
}}}
close $sock
}}
 
proc msg_playing { nick uhost hand arg } { playing $nick}
proc pub_playing { nick uhost hand chan arg } { global radiochans; if {([lsearch -exact [string tolower $radiochans] [string tolower $chan]] != -1) || ($radiochans == "")} { playing $nick  }}
 
 
 
proc isonline { nick uhost hand chan arg } {
global radiochans announce tellusers tellsongs tellbitrate urltopic dj
global offlinetext offlinetopic onlinetext onlinetopic
global streamip streampass streamport dj
global doalertadmin alertadmin
 
if {$announce == 1 || $tellsongs == 1 || $tellusers == 1 || $tellbitrate == 1} {
set isonlinefile "isonline"
set oldisonline "isonline: 0"
set oldcurlist "curlist: 0"
set oldcurhigh "curhigh: 0"
set oldsong "cursong: 0"
set oldbitrate "bitrate: 0"
if {[file exists $isonlinefile]} {
putlog "shoutcast: checking if stream is online"
set temp [open "isonline" r]
while {[eof $temp] != 1} {
set zeile [gets $temp]
if {[string first "isonline:" $zeile] != -1 } { set oldisonline $zeile }
if {[string first "curlist:" $zeile] != -1 } { set oldcurlist $zeile }
if {[string first "curhigh:" $zeile] != -1 } { set oldcurhigh $zeile }
if {[string first "cursong:" $zeile] != -1 } { set oldsong $zeile }
if {[string first "bitrate:" $zeile] != -1 } { set oldbitrate $zeile }
}
close $temp
}
 
 
if {[catch {set sock [socket $streamip $streamport] } sockerror]} {
putlog "error: $sockerror"
return 0} else {
puts $sock "GET /admin.cgi?pass=$streampass&mode=viewxml&page=0 HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $streamip"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
if { [string first "standalone" $bl] != -1 } {
set streamstatus "isonline: [string range $bl [shrink + 14 "<STREAMSTATUS>" 0 $bl] [shrink - 1 "</STREAMSTATUS>" 0 $bl]]"
set repl "curlist: [string range $bl [shrink + 19 "<REPORTEDLISTENERS>" 0 $bl] [shrink - 1 "</REPORTEDLISTENERS>" 0 $bl]]"
set curhigh "curhigh: [string range $bl [shrink + 15 "<PEAKLISTENERS>" 0 $bl] [shrink - 1 "</PEAKLISTENERS>" 0 $bl]]"
set currentl [string range $bl [shrink + 18 "<CURRENTLISTENERS>" 0 $bl] [shrink - 1 "</CURRENTLISTENERS>" 0 $bl]]
set surl "serverurl: [string range $bl [shrink + 11 "<SERVERURL>" 0 $bl] [shrink - 1 "</SERVERURL>" 0 $bl]]"
set cursong "cursong: [string range $bl [shrink + 11 "<SONGTITLE" 0 $bl] [shrink - 1 "</SONGTITLE>" 0 $bl]]"
set songurl [string range $bl [shrink + 9 "<SONGURL>" 0 $bl] [shrink - 1 "</SONGURL>" 0 $bl]]
set bitrate "bitrate: [string range $bl [shrink + 9 "<BITRATE>" 0 $bl] [shrink - 1 "</BITRATE>" 0 $bl]]"
set stitle "stitle: [string range $bl [shrink + 13 "<SERVERTITLE>" 0 $bl] [shrink - 1 "</SERVERTITLE>" 0 $bl]]"
set sgenre "sgenre: [string range $bl [shrink + 13 "<SERVERGENRE>" 0 $bl] [shrink - 1 "</SERVERGENRE>" 0 $bl]]"
}}
close $sock
}
 
set temp [open "isonline" w+]
puts $temp "$streamstatus\n$repl\n$curhigh\n$cursong\n$bitrate\n$stitle\n$sgenre\n$surl"
close $temp
if {$announce == 1 } {
if {$streamstatus == "isonline: 0" && $oldisonline == "isonline: 1"} {
	poststuff privmsg $offlinetext
	if {$doalertadmin == "1"} { sendnote domsen $alertadmin "radio is now offline" }
	if {$urltopic == 1} { poststuff topic $offlinetopic }
}
if {$streamstatus == "isonline: 1" && $oldisonline == "isonline: 0" } {
if {$sgenre != ""} {
set sgenre " ([lrange $sgenre 1 [llength $sgenre]] )"
}
poststuff privmsg "$onlinetext"
if {$urltopic == 1} { poststuff topic "$onlinetopic" }
}}
if {($tellusers == 1) && ($streamstatus == "isonline: 1") && ($oldcurhigh != "curhigh: 0") } {
if {$oldcurhigh != $curhigh} {
poststuff privmsg "new listener peak: [lindex $curhigh 1]"
}
if {$oldcurlist != $repl} {
poststuff privmsg "there are currently [lindex $repl 1] ($currentl) people listening"
}}
if {($tellsongs == 1) && ($oldsong != $cursong) && ($streamstatus == "isonline: 1") } {
if {$songurl != ""} { set songurl " ($songurl)"}
regsub -all "&#x3C;" $cursong "<" cursong
regsub -all "&#x3E;" $cursong ">" cursong
regsub -all "&#x26;" $cursong "+" cursong  
regsub -all "&#x22;" $cursong "\"" cursong
regsub -all "&#x27;" $cursong "'" cursong
regsub -all "&#xFF;" $cursong "" cursong
regsub -all "&#xB4;" $cursong "´" cursong
regsub -all "&#x96;" $cursong "-" cursong
regsub -all "&#xF6;" $cursong "צ" cursong
regsub -all "&#xE4;" $cursong "ה" cursong
regsub -all "&#xFC;" $cursong "" cursong
regsub -all "&#xD6;" $cursong "ײ" cursong
regsub -all "&#xC4;" $cursong "ִ" cursong
regsub -all "&#xDC;" $cursong "" cursong
regsub -all "&#xDF;" $cursong "" cursong
putlog $cursong
poststuff privmsg "now playing: [lrange $cursong 1 [llength $cursong]]$songurl"
}
 
if {($tellbitrate == 1) && ($oldbitrate != $bitrate) && ($streamstatus == "isonline: 1") && ($oldbitrate != "bitrate: 0")} {
poststuff privmsg "bitrate switched to [lindex $bitrate 1]kbps"
}}}
 
putlog "*** shoutcast.tcl v1.03 by domsen <domsen@domsen.org> succesfully loaded. turn it up baby."




hope this helps..


but i like this idea of yours;

* simple one, having a command like !addradio <shoutcast | icecast> name feed_url
  Reply
#6
Actually, the script works with only one radio (each) and the same variables.
The first thing to do is to change the variables to make them unique (or use a namespace), this is not too complex. I'll use namespace as there is probably (didn't read the scripts) procedures using the same name.
The second will be to store the radios informations somewhere else than in the script, like a radio.cfg file.
The third will be to check that commands are different.

If you want to have more than 2 radios (one icecast and one shoutcast), it will be an enormous work which will come later
irc.zeolia.net - Offrez-moi un café
Merci de ne pas demander d'aide en MP
  Reply
#7
(06/10/2021, 12:41)CrazyCat Wrote: Actually, the script works with only one radio (each) and the same variables.
The first thing to do is to change the variables to make them unique (or use a namespace), this is not too complex. I'll use namespace as there is probably (didn't read the scripts) procedures using the same name.
The second will be to store the radios informations somewhere else than in the script, like a radio.cfg file.
The third will be to check that commands are different.

If you want to have more than 2 radios (one icecast and one shoutcast), it will be an enormous work which will come later

wow.. that is nice.. waiting for it man.. :))))
  Reply
#8
Finally, I redo the script (based on the two provided). It will be longer, but commands will be the same whatever the kind of radio you use, and with the hability to have several radios
irc.zeolia.net - Offrez-moi un café
Merci de ne pas demander d'aide en MP
  Reply
#9
wow nice.. waiting for it .. i've sent PM last time hope you check it.. :)))
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)