This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Need help with radiobot

Old posts that have not been replied to for several years.
Locked
i
intrw

Need help with radiobot

Post by intrw »

I have a radiobot which needs to converts to eggdrop because its the only reason i run a windows server instead of linux. I have looked at every shoutcast tcl script but im not satisfied with any of them, too complicated i think.
If anyone can convert this script i will be very happy :)


on *:TEXT:!radioinfo:#:{ set %radiochanraf $chan | shopraf } }
alias shopraf { sockopen shtxtraf %ip %port }
on *:sockopen:shtxtraf:{ if ($sockerr) { msg %radiochanraf Server down | return } | else { write -c shop.txt | sockwrite -c $sockname GET /7.html HTTP/1.1 | sockwrite -n $sockname Accept: */* | sockwrite -n $sockname Accept-Language: nl | sockwrite -n $sockname Accept-Encoding: gzip, deflate | sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) | sockwrite -n $sockname Host: $ip $+ 8000 | sockwrite -n $sockname Connection: Keep-Alive | sockwrite -n $sockname $crlf } }
on *:sockread:shtxtraf:{ if ($sockerr) { return } | sockread -f &xsh.txt | bwrite shop.txt -1 -1 &xsh.txt }
on *:sockclose:shtxtraf:{ if ($regex(hs,$read(shop.txt,4),dy>(.*)</b)) { getsmraf $regml(hs,1) } }
alias getsmraf { tokenize 44 $1- | tokenize 32 $1- | if ($5 == $null) { return } | if ($2 == 1) { msg %radiochanraf Address: http:// $+ %ip $+ : $+ %port $+ /listen.pls | msg %radiochanraf DJ: %dj Listeners: $1 $+ / $+ $4 Record Listeners: $3 | msg %radiochanraf Song playing: $7- | unset %radiochanraf } | elseif ($2 == 0) { msg %radiochanraf ( Radio is down right now ) | unset %radiochanraf } }
Last edited by intrw on Tue Jan 27, 2004 7:47 pm, edited 1 time in total.
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

This ain't a mIRC forum. Talk Tcl or english, please :) (describe what the script does)
Have you ever read "The Manual"?
User avatar
NoFear
Halfop
Posts: 46
Joined: Wed Sep 10, 2003 8:36 am
Location: cW

Post by NoFear »

ok.. if you would search the tcl scripts on this site you would find something useful.. anyway here is the code that i found here.

Code: Select all

#      ,,        ,,
#    ,MMMM,    ,MMMM,                  ,lll,    ,
#   ,MM'MMM   ,MMM'MM,                ll ,ll   iii
#   MM'  MM, ,MM   'MM               ,ll,lll    '            ''
#   MM   'MM,MM'    MM    ,ee,  rr,rrlllll'   ,ii,   ,nnnnnn,'' ,ss
#  ,MM    'MMM'     MM    e::e  rrr' 'll,    ,i'ii   n'nn''nn  ,ss'
# ,MM'              MM,   :ee:  rr'   'll,   ii ii, ,n n'  nn, ss:
#MMM'               'MM, ,e''e,,rr     'll, ,ii 'ii,nn n   'nn,'ssss,
#MM'                 'MMeee  eerrr      'lllii'  'iinn n    nnn  :sss
#                                                                sss'
#      ,R==( by Gh0stWriteR Sep'99 E-Mail: clankrogoth@gmx.net )==s'
#    ,RR'
# ,RRRRRRRRRR, 
# RRR'RR' 'RRR,
# RR  RR   'RRRR            [TCL EggdropScript]
# RR  RR    :RRR
# RR  RR  ,RRRR'
# RR  RR ,RRR'
# RR  RRRRR:
#,RR  RR 'RRR,   ,eee, vv,  ,vv ,eee, nnn,nnn,  ,gggggg  ,eee,
#RRR ,RR  'RRR   ee:ee 'vv  vv' ee:ee 'nnnn'nn  ggg' gg  ee:ee
#RR' RRR   'RR,  eeee'  vv,,vv  eeee'  'nn' nn  gg'  gg  eeee'
#RR,RRR'    RRR, ee:    'vvvv'  ee:     nn  nn, gg,  gg, ee:
#'RRRR'     'RRR 'eeee   'vv'   'eeee   nn  nnn 'ggg'ggg,'eeee .gggg
#                                                  ,gggggggggggggg'
#                                      ,ggggggggggggggggg
#                         ,ggggggggggggggg'        ,gg
#                   ,gggggggggggg'                ,ggg
#               gggggggg:                       ,gggg'  
#                'ggggggggg,                  ,gggg'
#                     'ggggggggg,       ,ggggggg'
#                            'ggggggggggggg'
#
#
# Version with extended explinations
#
#/////////////////////////////////////////////////////////////////
#// RADIO Script for Shoutcaserver V0.6 BETA                    //
#// Name: MR {Merlins Revenge}                                  //
#// Script by Gh0stWriteR                                       //
#// EMail: clankrogoth@gmx.net                                  //
#/////////////////////////////////////////////////////////////////
#
# This Script is especially written vor the SFR
# Starfleet Radio - runnin on 7thradio.dyndns.org:8000
# special thx fly to ZeiRAM for Donuts Heaven
# special greetz fly to Andohr, Purple, Merlin, Sube
#
# Tested on Eggdrop(Suse 6.1 Linux Kernel 2.2.5) 1.3.28
# This script is able to analyse the downloaded website of a
# shoutcastserver Version 1.10 and to post several informations
# eg. current song (script check for example every minute the
# target file and if a new song is played then post the new song)
#
# ---------------------------------------------------------HISTORY
# 09/28/1999
# fixed logging (keep logspace)
# C - song bug detected - possible bug of the trim procedures
# too long Song names bug detected and fixed
# too long Server title bug detected and fixed
# uppercase public cmds bug fixed
# 09/26/1999
# Infos added
# V0.6 09/24/1999
# output design changed
# V0.5 09/24/1999
# merge public, join and main script into one radioscript
# V0.4 09/23/1999
# Public cmds added
# V0.3 09/22/1999
# user join information added
# V0.2 09/21/1999
# optimized for lynx - shell script added (shradio)
# V0.1 09/20/1999
# early buggy script (analyses orginal HTML code - but try to use 
# wget failed with shoutcast)


#=========>> NOTICE !! this is STILL a BETA Version <<============
#  ==> Its optimised for use for the SFR and is NOT a public <==
#  ==> Script - so if u are not familiar with TCL EMail me   <==
#  
# =======> DONT FORGET TO EDIT the SHRADIO Shell Script <=========

#=======================================GLOBAL VARIABLES==========

#targetchan "#channel" defines the channel on the IRC where the
# eggdrop is running on, where the Bot should post the 
# informations
set targetchan "#sfr"

#targetfile "file" is a text file where the website from the 
# shoutcast server is saved in - in order to actualise the postings
# you will need to use a shellscript or download the website 
# manually and save in this file
set targetfile "target.txt"

#targettime "minutes" is the time the scipt is waiting for new 
# data to analyse and post
set targettime "1"


#-----------------------------------------------------------------
#--             do NOT edit below THIS line !!!                 --
#--               or malfunction may cause                      --
#-----------------------------------------------------------------



#=======================================BINDINGS==================

#bindings defines actions from users the script can react on
# bind action options proc
# eg. bind pubm - * userpublic - reakt on all what a user post
# and call (run) userpublic

bind pubm - * userpublic
bind join - * userjoin



#=======================================DATA CONNECTION===========
proc datread {} {

 #global variable definitions is needed if u want to use variables
 # in the whole proc
 global s radio song inhalt targetchan targetfile targettime
 global oldradio oldsong olduser sip cuser maxuser addi kbps
 global oldurl url sourceuser olddj online cserver ctitle

#--------------------------------------------------------read Data
 set online "false"
 if {[file exists $targetfile]} {
    set read [open $targetfile r]
    while {![eof $read]} {
          set inhalt [gets $read]
#-----------------------------------------------------Server title
#test ob in der naechsten Zeile noch etwas steht (Zeilenumbruch)
          if {[string match "*1*" $cserver]} {
             set cserver "0"
             if {![string match "*Source connected*" $inhalt]} {
                set song "$song$inhalt"
                }
	     }
          set s "Stream title 'Radio: "  
          if {[string match "*Stream title*" $inhalt]} {
             set radio [string trimright $inhalt "'"]
             set radio [string trimleft $radio $s]
             set online "true"
             set cserver "1"
	     }
#------------------------------------------------------Music title
#test ob in der naechsten Zeile noch etwas steht (Zeilenumbruch)
          if {[string match "*1*" $ctitle]} {
             set ctitle "0"
             if {![string match "*Source connected*" $inhalt]} {
                set song "$song$inhalt"
                }
	     }
          set s "Current song:"
          if {[string match "*Current song*" $inhalt]} {
	     set song "$inhalt"
	     set ctitle "1"
	     }
#-----------------------------------------------------------Source	
          if {[string match "*Source connected*" $inhalt]} {
	     set sip [lindex $inhalt 3]
	     }	
#----------------------------------------------------kbps and user
          if {[string match "*Stream is up*" $inhalt]} {
	     set kbps [lindex $inhalt 4]
	     set cuser [lindex $inhalt 7]
	     set maxuser [lindex $inhalt 9]
	     }
#--------------------------------------------------------------URL
          if {[string match "*Stream url*" $inhalt]} {
	     set url [lindex $inhalt 2]
             }

          if {[eof $read]} {break}
          }
    close $read
#---------------------------------------------------------------DJ
    set s "fail"
    if {[string match "*SUBSPACERADIO*" $radio]} {
       set sourceuser "Sube"
       set s "true"
       }
    if {[string match "*7-t-h S-p-h-e-r-e*" $radio]} {
       set sourceuser "GhostwriteR"
       set s "true"
       }
    if {[string match "*(European Star Fleet Radio)*" $radio]} {
       set sourceuser "FATuscher"
       set s "true"
       }
    if {[string match "*Sleepwalker*" $radio]} {
       set sourceuser "Deelen"
       set s "true"
       }
    if {[string match "*Warp 9,9*" $radio]} {
       set sourceuser "David"
       set s "true"
       }
    if {[string match "*fail*" $s]} {
       set sourceuser "unknown"
       }
    if {$olddj != $sourceuser} {
       set olddj $sourceuser
       }
#----------------------------------------------------------OUTPUT
    if {$oldradio != $radio} {
       putserv "PRIVMSG $targetchan :\002$radio\002"
       putlog "$radio"
       set oldradio $radio
       }
    if {$oldsong != $song && ![string match "*Line Recording*" $song]} {
       putserv "PRIVMSG $targetchan :(\002$sourceuser\002) $song"
       putlog "($sourceuser@$sip): $song"
       set oldsong $song
       }
    if {$oldurl != $url } {
       putserv "PRIVMSG $targetchan :\002Stream URL\002: $url"
       set oldurl $url
       }

    timer {$targettime} {datread}
    }
}


#========================================SCRIPTSTART==============
#do NOT edit this variables !!
putlog "--==-- radio script V0.6 BETA by MR {Merlins Revenge} loaded"
set oldradio "1"
set oldsong "1"
set olduser "100000"
set oldurl "1"
set olddj "0"
set surcuser "1"
set radio "1"
set song "1"
set url "1"
set sip "1"
set cuser "10000000"
set maxuser "1000000000"
set sourceuser "1"
set online "1"
set kbps "1"
set check "0"
set cserver "0"
set ctitle "0"
timer {$targettime} {datread}



#=======================================PUBLIC USER CMDS==========
#if a user (nick) with the hostmask hostmask (uhost) write 
# something (text) in the channel (chan) this variables can be used
# to analyse the posting

proc userpublic {nick uhost hand chan text} {

 global radio song url sip cuser maxuser sourceuser online
#-------------------------------------------------------------HELP
 if {[string tolower $text] == "!help"} {
    putserv "NOTICE $nick : \002European Starfleet Radio\002"
    putserv "NOTICE $nick : This Bot is powered by \002MR\002 {Merlins Revenge}"
    putserv "NOTICE $nick : Script by Gh0stWriteR EMail: clankrogoth@gmx.net"
    putserv "NOTICE $nick : Public Commands are:"
    putserv "NOTICE $nick : \002!song\002       - post the current playing Song"
    putserv "NOTICE $nick : \002!radio\002      - post the current connected stream"
    putserv "NOTICE $nick : \002!user\002       - post the current ammount of listeners"
    putserv "NOTICE $nick : \002!url\002        - post the current Stream HP"
    putserv "NOTICE $nick : \002!moderator\002  - post the current DJ"
    putserv "NOTICE $nick : to connect to SFR open Winamp (2.05 or higher requiered)"
    putserv "NOTICE $nick : press \002STRG L\002 and enter : \0027thradio.dyndns.org:8000\002"
    
    if {$online == "false"} {
       putserv "NOTICE $nick : \002Stream is down\002 - No public commands active .."
       }
    }
#---------------------------------------------------------------DJ    
 if {[string tolower $text] == "!moderator" && $online == "true"} {
    putserv "NOTICE $nick : ($nick)  \002Current Moderator:\002  $sourceuser"
    }
#-------------------------------------------------------------SONG
 if {[string tolower $text] == "!song" && $online == "true"} {
    putserv "NOTICE $nick : ($nick)  \002Current Song:\002 $song played by $sourceuser"
    }
#------------------------------------------------------------RADIO
 if {[string tolower $text] == "!radio" && $online == "true"} {
    putserv "NOTICE $nick : ($nick)  \002Current Source:\002 $radio ($sourceuser)"
    }
#-------------------------------------------------------------USER
 if {[string tolower $text] == "!user" && $online == "true"} {
    putserv "NOTICE $nick : ($nick)  $cuser of $maxuser User listen \002SFR\002"
    }
#--------------------------------------------------------------URL
 if {[string tolower $text] == "!url" && $online == "true"} {
    putserv "NOTICE $nick : ($nick)  \002URL\002: $url"
    }


}

#=======================================JOIN USER=================
proc userjoin {nick uhost handle chan} {

 global radio song url sip cuser maxuser sourceuser online kbps
 if {[string match "*true*" $online]} {
    putserv "NOTICE $nick :\002$radio\002"
    putserv "NOTICE $nick : \002Moderator\002: $sourceuser"
    putserv "NOTICE $nick :\002Stream URL\002: $url"
    if {$song != "Line Recording"} {
       putserv "NOTICE $nick :\002new song\002: $song"
       }
    putserv "NOTICE $nick :Stream at $kbps kbps with $cuser of $maxuser User" 
    putserv "NOTICE $nick : For more help enter \002!help\002 in the chan"
    }
 if {[string match "*false*" $online]} {
    putserv "NOTICE $nick : \002STARFLEET RADIO\002"
    putserv "NOTICE $nick : \002Stream is down....\002"
    putserv "NOTICE $nick : For more help enter \002!help\002 in the chan"
    }
}
Way Away From Here..
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Can't you just post the link to it? :o It's so huge/long.. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
NoFear
Halfop
Posts: 46
Joined: Wed Sep 10, 2003 8:36 am
Location: cW

Post by NoFear »

hehe;) sorry;)
Way Away From Here..
i
intrw

Post by intrw »

:D
Locked