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 a Shoutcast script (Shoutcast V2)

Help for those learning Tcl or writing their own scripts.
Post Reply
T
Troja
Voice
Posts: 1
Joined: Fri Oct 27, 2023 12:29 pm
Location: Germany
Contact:

Need help with a Shoutcast script (Shoutcast V2)

Post by Troja »

Hello everyone,
I'm looking for a script for Shoutcast 2, with which you can sit down as a DJ and receive requests.
In order to be able to receive wishes or greetings, you can also activate or deactivate them.

We already had something pretty good, but now with the switch to Shoutcast V2 it's not really working anymore.

As long as only one stream (ID 1) is running everything is ok, but as soon as we start another one (ID 2) the whole script goes crazy.
The title display then no longer works properly, etc.

The thing with the ID definitely has to be added, but unfortunately I don't know where exactly and especially not how :-/

Our main stream would be sid 1

Everything else works, but as I said, as soon as I start another stream (ID 2) ... the entire title display no longer works as it should.

And we have another problem: the umlauts (Ä Ö Ü ä ö ü ß) are all displayed incorrectly and so are apostrophes ( ' ).

I'll say thank you in advance :)

PS: Nobody has to put a finished script in here for me, it would be enough for me if I knew where and how to enter it with the ID history everywhere



sc.cfg

Code: Select all

###############################################################################################################################
#                                                                                                                             # 
# LoReZ ShoutCast Script v2.1 (sc.tcl)                                                                                        #
# Email: lorez@bigvibez.com                                                                                                   #
# IRC: #bigvibez @ Quakenet                                                                                                   #
#                                                                                                                             #
# Please contact me if you notice any bugs                                                                                    #
#                                                                                                                             #
# Installation: Put the script and the config file into your scripts directory, add "source scripts/sc.tcl" to your eggdrop   #
#               config and rehash the bot. (http package is REQUIRED for this script to work)                                 #                                                                                              #
#                                                                                                                             #
###############################################################################################################################

###############################################################################################################################
#                                                START OF CONFIGURATION FOR SC.TCL                                            #
###############################################################################################################################

### Stream Settings ###

# A Description for your Stream
set sc::vars(desc) "Retter-Radio.de"

# The IPdress of your Stream
set sc::vars(ip) "123.45.678.910"

# The Port on which ShoutCast runs
set sc::vars(port) "8000"

# The ID on which ShoutCast runs
# set sc::vars(ID) "1"

# The Password of your Stream
set sc::vars(pass) "xxxxxxxxx" 

# The MIME encrypted Admin Password of your Stream (you can get it with mIRC by typing //echo -a $encode(admin:adminpassword,m)
set sc::vars(adpass) "xxxxxxxxx"

# The Channels on which the Bot shall react on Commands
set sc::vars(chans) "#retter-radio #retter-team"

# The Intern Channel to which the Bot sends Wishes and Greets (if send Wishes and Greets to Intern Channel is activated)
set sc::vars(intern) "#retter-team"

# The File where the Data shall be stored
set sc::vars(file) "scripts/sc.db"

# The Flag required for kicking the Source and un/setting the DJ
set sc::vars(flag) ""

# The Trigger used for Commands
set sc::vars(trigger) "!"


### General Settings ###

# Enable Public Commands (0 = No | 1 = Yes)
set sc::sets(pub) 1

# Enable Message Commands (0 = No | 1 = Yes)
set sc::sets(msg) 1

# Reply In Channel (0 = No | 1 = Yes)
set sc::sets(reply) 1

# Where to send Wishes and Greets (0 = DJ | 1 = Intern Channel)
set sc::sets(wishgreet) 0

# Announce Track Changes (0 = No | 1 = Yes)
set sc::sets(anntrack) 0

# Announce Bitrate Changes (0 = No | 1 = Yes)
set sc::sets(annbitrate) 0

# Announce Listener Count Changes (0 = No | 1 = Yes)
set sc::sets(annlist) 0

# Announce Peak Changes (0 = No | 1 = Yes)
set sc::sets(annpeak) 0

# Announce DJ Changes (0 = No | 1 = Yes)
set sc::sets(anndj) 1

# Announce when Stream goes on/offline (0 = No | 1 = Yes)
set sc::sets(ann) 0

# Advertise Stream (0 = No | 1 = Yes)
set sc::sets(adv) 0

# Advertise every X Minutes 
set sc::sets(advtime) 15

# Change Topic when Stream goes on/offline
set sc::sets(topchg) 1

# Change Topic when the DJ Changes
set sc::sets(djtopchg) 1

# Change Topic with Q Bot (QuakeNet)
set sc::sets(qtopic) 0

    
### Command and Text Settings ###

# In the texts you can use these variables:
# %listeners %peak %max %unique %avgtime %genre %url %title %song %songurl %irc %icq %aim %webhits %streamhits %bitrate %content %version %ip %port %desc %lastsongs %djnick %dj %showname %status

# Stream Trigger
set sc::triggers(stream) "stream"
# Text when someone uses the Stream Trigger
set sc::texts(stream) "Unser Stream: http://retter-radio.de:8000/listen.pls ..::.. Alternative !realpl ..::.. !wmp ..::.. !telefon"

# Info Trigger
set sc::triggers(info) "info"
# Text when someone uses the Info Trigger
set sc::texts(info) "Das Retter-Radio ist ein Webradio welches nicht nur fuer Alltagsretter spielt, ausserdem bieten wir einen Spielebereich auf unserer Seite an. Klick www.retter-radio.de"

# Mod Trigger
set sc::triggers(mod) "mod"
# Text when someone uses the Mod Trigger
set sc::texts(mod) "Jetzt sendet fuer euch: %dj"

# Song Trigger
set sc::triggers(song) "lied"
# Text when someone uses the Song Trigger
set sc::texts(song) "Jetzt laeuft: %song"

# Hoerer Trigger
set sc::triggers(hoerer) "hoerer"
# Text when someone uses the Hoerer Trigger
set sc::texts(hoerer) "Das erfaehrst Du vielleicht vom Moderator"

# Plan Trigger
set sc::triggers(plan) "plan"
# Text when someone uses the Plan Trigger
set sc::texts(plan) "Sendeplan: https://www.retter-radio.de/radioforum/sendeplan_ausgabe.php"

# Stream Winamp Trigger
set sc::triggers(winamp) "winamp"
# Text when someone uses the Stream Winamp Trigger
set sc::texts(winamp) "Winamp: http://retter-radio.de:8000/listen.pls"

# Stream Realplayer Trigger
set sc::triggers(realpl) "realpl"
# Text when someone uses the Stream Realplayer Trigger
set sc::texts(realpl) "RealPlayer: https://www.retter-radio.de/stream.ram"

# Stream WMP Trigger
set sc::triggers(wmp) "wmp"
# Text when someone uses the Stream WMP Trigger
set sc::texts(wmp) "Windows Media Player: https://www.retter-radio.de/listen.m3u"

# Stream Telefon Trigger
set sc::triggers(telefon) "telefon"
# Text when someone uses the Stream Telefon Trigger
set sc::texts(telefon) "Telefonstream: 0541 4444 17740 ..::.. Festnetztarif ..:::. Mit Flatrate zum Nulltarif"

# Telefonwunsch Trigger
set sc::triggers(telewunsch) "telewunsch"
# Text when someone uses the Telefonwunsch Trigger
set sc::texts(telewunsch) "Telefonwunsch -gruss: 0541 4444 17739 ..::.. Festnetztarif ..::.. Mit Flatrate zum Nulltarif "

# Streamadressen Trigger
set sc::triggers(streams) "streams"
# Text when someone uses the Streamadressen Trigger
set sc::texts(streams) " Unsere Streams: !winamp ..::.. !realpl ..::.. !wmp ..::.. !telefon"

# Last Songs Trigger
set sc::triggers(lsongs) "lastsongs"
# Text when someone uses the Last Songs Trigger
set sc::texts(lsongs) "davor gespielte Lieder: %lastsongs"

### You can remove Commands by deleting or commenting a Trigger and a Text for the Command ###
### You can also add Commands by setting up a Trigger and a Text for the Command. E.g.: ###
# Homepage Trigger
set sc::triggers(hp) "hp"
# Text when someone uses the Homepage Trigger
set sc::texts(hp) "Homepage: www.retter-radio.de"

    
# Help Trigger
set sc::triggers(help) "help"

# Wish Trigger
#set sc::triggers(wish) "wunsch"

# Greet Trigger
#set sc::triggers(greet) "gruss"

# Greet Trigger
#set sc::triggers(greet) "gruß"

# Kick Trigger
set sc::triggers(kick) "kick"

# Set DJ Trigger
set sc::triggers(setdj) "setdj"

# Unset DJ Trigger
set sc::triggers(unsetdj) "unsetdj"


# Text that is advertised (if advertise Stream is activated)
set sc::texts(adv) "tune in @ http://%ip:%port/listen.pls"

# Text when Stream goes online (if announce when Stream goes on/offline is activated)
set sc::texts(on) "Retter-Radio ist nun online Stream: http://www.retter-radio.de/listen.pls"

# Text when Stream goes offline (if announce when Stream goes on/offline is activated)
set sc::texts(off) "Retter-Radio ist momentan offline!"

# Text for the Topic when Stream goes online (if change Topic when Stream goes on/offline is activated)
set sc::texts(ontopic) ".. Willkommen im Chat von retter-radio.de :: Stream: http://retter-radio.de:8000/listen.pls :: Sendeplan: www.retter-radio.de/radioforum/sendeplan_ausgabe.php :: Aktuell auf Sendung: die Plattenkiste .."

# Text for the Topic when Stream goes offline (if change Topic when Stream goes on/offline is activated)
# set sc::texts(offtopic) ".. Willkommen im Chat von retter-radio.de :: Stream: http://retter-radio.de:8000/listen.pls :: Sendeplan: www.retter-radio.de/radioforum/sendeplan_ausgabe.php :: Retter-Radio ist momentan offline! .."

# Text for the Topic when the DJ changes (if change Topic when DJ changes is activated)
set sc::texts(djtopic) ".. Willkommen im Chat von retter-radio.de :: Stream: http://retter-radio.de:8000/listen.pls :: Sendeplan: www.retter-radio.de/radioforum/sendeplan_ausgabe.php :: Aktuell auf Sendung: %dj .."

# Text when a new Song is playing (if announce when Track changes is activated)
set sc::texts(songchg) "New Track playing: %song"

# Text when the Listener Count changes (if announce when Listener Count changes is activated)
set sc::texts(listchg) "There are now %listeners (%unique) of %max people listening"

# Text when the Bitrate Changes (if announce when Bitrate changes is activated)
set sc::texts(bitratechg) "Bitrate changed to %bitrate"

# Text when the Peak changes (if announce when Peak changes is activated)
set sc::texts(peakchg) "New Peak: %peak"

# Text when the DJ changes (if announce when DJ changes is activated)
set sc::texts(djchg) "Jetzt sendet für euch %dj"

# Text when Stream is offline and someone uses a Command
set sc::texts(offcmd) "Der Stream laeuft aber ich der RetterBote kann ihn nicht auslesen ... darum momentan offline"
    
###############################################################################################################################
#                                                 END OF CONFIGURATION FOR SC.TCL                                             #
###############################################################################################################################

sc.tcl

Code: Select all

###############################################################################################################################
#																															 # 
# LoReZ ShoutCast Script v2.1 (sc.tcl)																						#
# Email: lorez@bigvibez.com																								   #
# IRC: #bigvibez @ Quakenet																								   #
#																															 #
# Please contact me if you notice any bugs																					#
#																															 #
# Installation: Put the script and the config file into your scripts directory, add "source scripts/sc.tcl" to your eggdrop   #
#			   config and rehash the bot. (http package is REQUIRED for this script to work)								 #
#
# Version v2.3.1 by virtu @ 06.04.2014																							  #
#																															 #
###############################################################################################################################

###############################################################################################################################
#														  START OF TCL CODE												  #
###############################################################################################################################

package require http

bind pub - !wunsch wunsch
bind pub - !gruss greet

namespace eval sc {
	variable vars
	variable sets
	variable triggers
	variable texts
	variable offadv 0
	source scripts/sc.cfg
	proc init {} {
		set start [clock clicks]
		set sc::offadv 0
		bind time - "* * * * *" sc::check
		bind nick - * sc::nick
		foreach x [array names sc::triggers] {
			if {$sc::sets(pub) == 1} {
				bind pub [expr {($x == "kick") || ($x == "setdj") || ($x == "unsetdj") ? "$sc::vars(flag)" : "-"}] $sc::vars(trigger)$sc::triggers($x) "sc::pub $x"
			}
			if {$sc::sets(msg) == 1} {
				bind msg [expr {($x == "kick") || ($x == "setdj") || ($x == "unsetdj") ? "$sc::vars(flag)" : "-"}] $sc::vars(trigger)$sc::triggers($x) "sc::msg $x"
			}
		}
		if {$sc::sets(adv) == 1} {
			timer $sc::sets(advtime) "sc::post privmsg none all {$sc::texts(adv)}"
		}
		putlog "sc.tcl v2.3.1 by LoReZ and virtu successfully initialized in [expr {([clock clicks]-$start)/1000.0}]ms"		
	}
	proc pub {text nick uhost hand chan arg} {
		if {([lsearch -exact [string tolower $sc::vars(chans)] [string tolower $chan]] != -1) || ($sc::vars(chans) == "")} {
			sc::cmd $text $nick $chan $arg
		}
	}
	proc msg {text nick uhost hand arg} {
		sc::cmd $text $nick none $arg
	}
	proc nick {nick uhost hand chan newnick} {
		set tmp [open $sc::vars(file) r]
		gets $tmp streamdata
		gets $tmp songdata
		gets $tmp djdata
		close $tmp
		if {$nick == [lindex $djdata 0]} {
			set tmp [open $sc::vars(file) w+]
			puts $tmp $streamdata
			puts $tmp $songdata
			puts $tmp "$newnick [expr {([lindex $djdata 1] == $nick) ? $newnick : [lindex $djdata 1]}] [lrange $djdata 2 end]"
			close $tmp
			if {([lindex $djdata 1] == $nick) && ($sc::sets(djtopchg) == 1)} {
				#sc::post topic none all "$sc::texts(djtopic)"
			}
		}			
	}
	proc cmd {text nick chan arg} {
		set args [split $arg]
		if {[file exists $sc::vars(file)] != 1} {
			sc::check * * * * *
		}
		set tmp [open $sc::vars(file) r]
		gets $tmp streamdata
		gets $tmp songdata
		gets $tmp djdata
		close $tmp
		switch -exact $text {
			help {
				set sc::offadv 1
				putquick "privmsg $nick :Available Commands:"
				foreach x [array names sc::triggers] {
					if {$x != "help"} {
						if {(([matchattr [nick2hand $nick $chan] +$sc::vars(flag) $chan] != 1) && ($x != "kick") && ($x != "setdj") && ($x != "unsetdj")) || ([matchattr [nick2hand $nick $chan] +$sc::vars(flag) $chan] == 1)} {
							set sc::offadv 1
							putquick "privmsg $nick :$sc::vars(trigger)[expr {($x == "setdj") ? "$sc::triggers($x)" : [expr {(($x == "wish") || ($x == "greet")) ? "$sc::triggers($x) <$x>" : "$sc::triggers($x)"}]}]"  
						}
					}
				}
				set sc::offadv 1
				putquick "privmsg $nick :End of Commands"
			}
			kick {
				if {$chan ne $sc::vars(intern) || (![isop $nick $chan] && ![ishalfop $nick $chan])} {return}
				putquick "privmsg $nick :Source successfully kicked"
				if {[lindex $streamdata 15] == 1} {
					set sock [socket $sc::vars(ip) $sc::vars(port)]
					puts $sock "GET /admin.cgi?mode=kicksrc HTTP/1.1"
                              puts $sock "User-Agent:Mozilla"
					puts $sock "Host: $sc::vars(ip)"
					puts $sock "Authorization: Basic $sc::vars(adpass)"
					puts $sock ""
					flush $sock
				}
			}
			setdj {
				if {$chan ne $sc::vars(intern) || (![isop $nick $chan] && ![ishalfop $nick $chan])} {return}
				putquick "PRIVMSG $chan :Du bist jetzt der DJ vom Retter-Radio, bitte setze ein Motto z.B. !motto Rock"
				if {[lindex $streamdata 15] == 1} {
					set tmp [open $sc::vars(file) w+]
					puts $tmp $streamdata
					puts $tmp $songdata
					puts $tmp [list $nick [expr {([lindex $args 0] == "") ? $nick : [lindex $args 0]}] [lrange $args 1 end]]
					close $tmp
					if {$sc::sets(anndj) == 1} {
						sc::post privmsg none all "$sc::texts(djchg)"
					}
					if {$sc::sets(djtopchg) == 1} {
						sc::post topic none all "$sc::texts(djtopic)"
					}
				}
			}
			unsetdj {
                if {$chan ne $sc::vars(intern) || (![isop $nick $chan] && ![ishalfop $nick $chan])} {return}
                putquick "PRIVMSG $chan :Du bist nicht mehr der DJ vom Retter-Radio"
                channel set $::radioIntern motto "Unsere Plattenkiste spielt ueberwiegend Musik der 80er Jahre"
                if {[lindex $streamdata 15] == 1} {
                    set tmp [open $sc::vars(file) w+]
                              
                    puts $tmp $streamdata
                    puts $tmp $songdata
                    puts $tmp "none none none"
                    close $tmp
                    if {$sc::sets(anndj) == 1} {
                        sc::post privmsg none all "$sc::texts(djchg)"
                    }
                    if {$sc::sets(djtopchg) == 1} {
                        sc::post topic none all "$sc::texts(ontopic)"
                    }
                }
            }
			default {
				if {($text != "wish") && ($text != "greet")} {
					sc::post privmsg $nick $chan "$sc::texts($text)"
				} else {
					if {[lindex $streamdata 15] == 1} {
						if {($arg == "{}")} {
						putquick "privmsg $nick :Nothing specified"
					} else {
						sc::post privmsg $nick none "$sc::texts(offcmd)"}
					}
				}
			}
		}
		putlog "sc.tcl v2.3.1 $nick used $sc::vars(trigger)$sc::triggers($text)"
	}		   
	proc check {min hour day month year} {
		set start [clock clicks]
		if {[file exists $sc::vars(file)] == 1} {
			set tmp [open $sc::vars(file) r]
			gets $tmp olddata
			gets $tmp songdata
			gets $tmp djdata
			close $tmp
		} else {
			set olddata "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
			set djdata "none none none"
		}
		http::config -useragent "Mozilla 5.0"
		set con [http::geturl http://$sc::vars(ip):$sc::vars(port)/statistics -timeout 10000]
		set urldata [http::data $con]
		http::cleanup $con 
		foreach {y z} {21 ! 22 \" 23 # 24 \$ 25 % 26 + 27 ' 28 \( 29 \) 2A * 2B + 2C , 2E . 2F / 3A : 3B \; 3C < 3D = 3E > 3F ? 40 @ 5B \[ 5C \\ 5D \] 5F _ 60 ` C0 À C1 Á C2 Â C3 Ã C4 Ä C5 Å C6 Æ C7 Ç C8 È C9 É CA Ê CB Ë CC Ì CD Í CE Î CF Ï D1 Ñ D2 Ò D3 Ó D4 Ô D5 Õ D6 Ö D9 Ù DA Ú DB Û DC Ü DD Ý DF ß E0 à E1 á E2 â E3 ã E4 ä E5 å E6 æ E7 ç E8 è E9 é EA ê EB ë EC ì ED í EE î EF ï F0 ð F1 ñ F2 ò F3 ó F4 ô F5 õ F6 ö F9 ù FA ú FB û FC ü FD ý FE þ FF ÿ} {
			regsub -all "&#x$y;" $urldata "$z" urldata 
		}
		regsub -all ".*<SHOUTCASTSERVER>" $urldata "" data1
		regsub -all "<WEBDATA>.*" $data1 "" data1
		regsub -all ".*<SONGHISTORY>" $urldata "\{" data2
		regsub -all "</SONGHISTORY>.*" $data2 " \}" data2
		set x 0
		foreach y {CURRENTLISTENERS PEAKLISTENERS MAXLISTENERS REPORTEDLISTENERS AVERAGETIME SERVERGENRE SERVERURL SERVERTITLE SONGTITLE SONGURL IRC ICQ AIM WEBHITS STREAMHITS STREAMSTATUS BITRATE CONTENT VERSION SONG PLAYEDAT TITLE} {
			if {$x < 19} {
				regsub -all ".*<$y>" $data1 "" data10
				regsub -all "</$y>.*" $data10 "" data10
				lappend streamdata [expr {(($data10 == "0") || ($data10 == "")) && ([string match -nocase *listeners "$y"] != 1) && ([string match -nocase *hits "$y"] != 1) && ([string match -nocase *time "$y"] != 1) ? "N/A" : $data10}]
			}
			if {$x > 18} {
				regsub -all "<$y>" $data2 "\{" data2
				regsub -all "</$y>" $data2 "\} " data2
			}
			incr x
		}
		set tmp [open $sc::vars(file) w+]
		puts $tmp $streamdata
		puts $tmp $data2
		puts $tmp $djdata
		close $tmp
		if {[lindex $olddata 15] != [lindex $streamdata 15]} {
			if { ($sc::sets(ann) == 1)} {
				set sc::offadv [expr {([lindex $streamdata 15] == 1) ? 0 : 1}]
				sc::post privmsg none all "[expr {([lindex $streamdata 15] == 1) ? $sc::texts(on) : $sc::texts(off)}]"
			}
			if {$sc::sets(topchg) == 1} {
				set sc::offadv [expr {([lindex $streamdata 15] == 1) ? 0 : 1}]
				sc::post topic none all "[expr {([lindex $streamdata 15] == 1) ? $sc::texts(ontopic) : $sc::texts(offtopic)}]"
			}
		}
		foreach {x y z} {8 anntrack songchg 0 annlist listchg 1 annpeak peakchg 16 annbitrate bitratechg} {
			if {([lindex $olddata $x] != [lindex $streamdata $x]) && ($sc::sets($y) == 1)} {
				sc::post privmsg all all "$sc::texts($z)"
			}
		}
		putlog "sc.tcl v2.3.1 received information from $sc::vars(ip):$sc::vars(port) in [expr {([clock clicks]-$start)/1000.0}]ms"
	}			  
	proc post {mode nick chan text} {
		set tmp [open $sc::vars(file) r]
		gets $tmp streamdata
		gets $tmp songdata
		gets $tmp djdata
		close $tmp
		if {([lindex $streamdata 15] == 1) || ($sc::offadv == 1)} {
			foreach x [lindex $songdata 0] {
				append lastsongs "[lindex $x 1] :: "
			}
			lappend streamdata $sc::vars(ip) $sc::vars(port) $sc::vars(desc) ":: $lastsongs" [expr {(([lindex $djdata 0] == "none") || ([lindex $djdata 0] == "{}") || ([lindex $djdata 0] == "")) ? "No DJ" : [lindex $djdata 0]}] [expr {(([lindex $djdata 1] == "none") || ([lindex $djdata 1] == "{}") || ([lindex $djdata 1] == "")) ? "No DJ" : [lindex $djdata 1]}] [expr {(([lindex $djdata 2] == "none") || ([lindex $djdata 2] == "{}") || ([lindex $djdata 2] == "")) ? "No Show" : [lrange $djdata 2 end]}] [expr {([lindex $streamdata 15] == 1) ? "online" : "offline"}]
			set x 0
			foreach y {listeners peak max unique avgtime genre url title song songurl irc icq aim webhits streamhits streamstatus bitrate content version ip port desc lastsongs djnick dj showname status} {
				regsub -all "%$y" $text "[lindex $streamdata $x]" text
				incr x
			}
			if {$mode == "topic"} {
				foreach chans [channels] {
					if {$sc::vars(chans) == ""} {
						if {$sc::sets(qtopic) == 1} {
							putquick "privmsg TheQBot@CServe.quakenet.org :SETTOPIC $chans $text"
						} else {
							putquick "$mode $chans :$text"
						}
					} else {
						if {([lsearch -exact [string tolower $sc::vars(chans)] [string tolower $chans]] != -1)} {
							if {$sc::sets(qtopic) == 1} {
								putquick "privmsg TheQBot@CServe.quakenet.org :SETTOPIC $chans $text"
							} else {
								putquick "$mode $chans :$text"
							}
						}				
					}
				}
			} else {
				if {($sc::sets(reply) != 1) || ($chan == "none")} {
					putquick "$mode $nick :$text"
				}
				if {$chan ne "none"} {
						putquick "$mode $chan :$text"
				} elseif {(($sc::sets(reply) == 1) && ($chan != "none")) || ($chan == "all")} {
					foreach chans [channels] {
						if {$sc::vars(chans) == ""} {
							putquick "$mode $chans :$text"
						} else {
							if {([lsearch -exact [string tolower $sc::vars(chans)] [string tolower $chans]] != -1)} {
								putquick "$mode $chans :$text"
							}
						}
					}
				}
			}
		} else {
			putquick "$mode [expr {((($sc::sets(reply) != 1) || ($chan == "none")) && ($chan != "all")) ? $nick : $chan}] :$sc::texts(offcmd)"
		}
		set sc::offadv 0
	}

	proc streaminfo {id} {
		set tmp [open $sc::vars(file) r]
		gets $tmp streamdata
		gets $tmp songdata
		gets $tmp djdata
		close $tmp
		lindex $streamdata [lsearch -exact -nocase {listeners peak max unique avgtime genre url title song songurl irc icq aim webhits streamhits streamstatus bitrate content version ip port desc lastsongs djnick dj showname status} $id]
	}

	sc::init
}

proc wunsch {nick host hand chan arg} {
	global ::wishgreet waittime sc
	set hostname "*!$host"
	set args [split $arg]
	if {[file exists $sc::vars(file)] != 1} {
		sc::check * * * * *
	}
	set tmp [open $sc::vars(file) r]
	gets $tmp streamdata
	gets $tmp songdata
	gets $tmp djdata
	close $tmp
	if {[info exists ::waittime($hostname)]} { return }
	if {[lindex $streamdata 15] == 1} {
		if {($arg == "{}")} {
			putquick "privmsg $nick :Nothing specified"
		} else {
			if {([lindex $djdata 1] == "none") || (${::wishgreet:on} == 0)} {
				putquick "PRIVMSG $chan :Momentan werden keine Wuensche akzeptiert."
			} else {
				putserv "PRIVMSG [expr {($sc::sets(wishgreet) == 1) ? $sc::vars(intern) : [lindex $djdata 0]}] :Wunsch von $nick: $arg"
				putquick "NOTICE $nick :Dein Wunsch wurde an den Moderator weitergeleitet. Bitte habe Verstaendnis dafuer, dass es dauern kann bis dieser gespielt wird!"
				set waittime($hostname) "1"
				utimer 60 [list unset ::waittime($hostname)]
					puthelp "NOTICE $nick :..... Deinen naechsten Wunsch kannst Du in 60 Sekunden wieder abgeben. Bitte habe Verstaendnis dafuer."
			}
		}
	} else {
		sc::post privmsg $nick none "$sc::texts(offcmd)"
	}

	putlog "sc.tcl v2.3.1 $nick used !wunsch"
}

proc greet {nick host hand chan arg} {
	global ::wishgreet waittime sc ::greet
	set hostname "*!$host"
	set args [split $arg]
	if {[file exists $sc::vars(file)] != 1} {
		sc::check * * * * *
	}
	set tmp [open $sc::vars(file) r]
	gets $tmp streamdata
	gets $tmp songdata
	gets $tmp djdata
	close $tmp
	if {[info exists ::waittime($hostname)]} { return }
	if {[lindex $streamdata 15] == 1} {
		if {($arg == "{}")} {
			putquick "privmsg $nick :Nothing specified"
		} else {
			if {([lindex $djdata 1] == "none") || (${::wishgreet:on} == 0) && (${::greet:on} == 0)} {
				putquick "PRIVMSG $chan :Momentan werden keine Gruesse akzeptiert."
			if (${::wishgreet:on} == 0) && (${::greet:on} == 1)} {
			putserv "PRIVMSG [expr {($sc::sets(wishgreet) == 1) ? $sc::vars(intern) : [lindex $djdata 0]}] :Gruss von $nick: $arg"
			putquick "NOTICE $nick :Dein Gruss wurde an den Moderator weitergeleitet."
			set waittime($hostname) "1"
			utimer 30 [list unset ::waittime($hostname)]
					puthelp "NOTICE $nick :..... Deinen naechsten Gruss kannst Du in 30 Sekunden wieder abgeben. Bitte habe Verstaendnis dafuer."
			}
		}
	} else {
		sc::post privmsg $nick none "$sc::texts(offcmd)"
	}

	putlog "sc.tcl v2.3.1 $nick used !gruss"
}

###############################################################################################################################
#														   END OF TCL CODE												   #
###############################################################################################################################
Post Reply