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.

more radio and mor room

Help for those learning Tcl or writing their own scripts.
Post Reply
T
Tommyken
Voice
Posts: 11
Joined: Wed Apr 09, 2008 1:11 pm

more radio and mor room

Post by Tommyken »

Hello all,

i've found a script (sorry i forgot name) but i've a problem.
This is as following. This script works fine, but for one radio and one room.
I want a second radiostation for an other room. P.e. #Room1 has radio1 and #room2 has radio2. With use of same commands, thx advanced.

Code: Select all


# Stream URL (e.g. http://domain.tld:port OR http://IP:port)
set url "urlofradio1:port"

# Playlist URL (Leave empty for default stream playlist)
set playlist ""

# Public/User Channel
set streamch "#room1"

# Private/DJ Channel
set djch  "#room1"
set huidige "huidig"
set tweede "vorig"
set derde "derde"
set vierdes "vierde"
set vijfdes "vijfde"
set zesdes "zesde"
set zevendes "zeven"
set achtstes "acht"
set negendes "negen"



##########################
###### DO NOT EDIT #######
##########################

package require http

bind time - * go

bind pub -|- !start go
proc go {min hour day month year} {
   global url streamch chan huidige tweede derde vierdes vijfdes zesdes zevendes achtstes negendes liedje 
   set chan  "#radiovollemaan"

set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} { 
   	set http_req [::http::geturl $url -timeout 2000]
	if {[::http::status $http_req] != "ok"} {
		puthelp "PRIVMSG $chan :Stream is unavailable";
	}
	set data [::http::data $http_req]
	::http::cleanup $http_req
	if {[regexp {<font class=default>Current Song: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
		
		if {$huidige == $title} {
		
		} else {
			if {$tweede == $title} {
			} else {
				if {$derde == $title} {
				} else {
					if {$vierdes == $title} {
					} else {
						if {$vijfdes == $title} {
						} else {
							if {$zesdes == $title} {
							} else {
								if {$zevendes == $title} {
								} else {
									if {$achtstes == $title} {
									} else {
										if {$negendes == $title } {
										} else {
										set negendes $achtstes
										set achtstes $zevendes
										set zevendes $zesdes
										set zesdes $vijfdes
									
										set vijfdes $vierdes
										set vierdes $derde
										set derde $tweede
										set tweede $huidige
										set huidige $title
										puthelp "PRIVMSG $chan :\00300,12Current Song\003: \00312,00 $title\003"
										}
									}
								}
							}
						}
					}
				}
			}
		}
	
	} else {
		puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
		 return 0
	}
   }
                  
}

bind pub -|- !song get_shoutcast_song 
bind pub -|- !np get_shoutcast_song 


proc get_shoutcast_song {nick uhost hand chan arg} {
   global url streamch
   set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} { 
   	set http_req [::http::geturl $url -timeout 2000]
	if {[::http::status $http_req] != "ok"} {
		puthelp "PRIVMSG $chan :Stream is unavailable";
	}
	set data [::http::data $http_req]
	::http::cleanup $http_req
	if {[regexp {<font class=default>Current Song: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
		puthelp "PRIVMSG $chan :\002Current Song\002: $title"
	} else {
		puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
		get_shoutcast_server $nick $uhost $hand $chan $arg
	}
   }
}

bind pub -|- !title get_shoutcast_title
bind pub -|- !dj get_shoutcast_title
proc get_shoutcast_title {nick uhost hand chan arg} {
   global url streamch
   set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} { 
   	set http_req [::http::geturl $url -timeout 2000]
	if {[::http::status $http_req] != "ok"} {
		puthelp "PRIVMSG $chan :Stream is unavailable";
	}
	set data [::http::data $http_req]
	::http::cleanup $http_req
	if {[regexp {<font class=default>Stream Title: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
		puthelp "PRIVMSG $chan :\002DJ\002: $title"
	} else {
		puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
		get_shoutcast_server $nick $uhost $hand $chan $arg
	}
   }
}

bind pub -|- !site get_shoutcast_site
bind pub -|- !url get_shoutcast_site
bind pub -|- !website get_shoutcast_site
proc get_shoutcast_site {nick uhost hand chan arg} {
   global url streamch
   set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} { 
   	set http_req [::http::geturl $url -timeout 2000]
	if {[::http::status $http_req] != "ok"} {
		puthelp "PRIVMSG $chan :Stream is unavailable";
	}
	set data [::http::data $http_req]
	::http::cleanup $http_req
	if {[regexp {>http://([^<]+)</a></b>} $data x title]} {
		puthelp "PRIVMSG $chan :\002Website\002: http://$title"
	} elseif {[regexp {>www.([^<]+)</a></b>} $data x title]} {
		puthelp "PRIVMSG $chan :\002Website\002: http://www.$title"
	} else {
		puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
		get_shoutcast_server $nick $uhost $hand $chan $arg
	}
   }
}

bind pub -|- !server get_shoutcast_server
proc get_shoutcast_server {nick uhost hand chan arg} {
   global url streamch
   set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} { 
   	set http_req [::http::geturl $url -timeout 2000]
	if {[::http::status $http_req] != "ok"} {
		puthelp "PRIVMSG $chan :Stream is unavailable";
	}
	set data [::http::data $http_req]
	::http::cleanup $http_req
	if {[regexp {<font class=default>Server Status: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
		puthelp "PRIVMSG $chan :\002Server\002: $title"
	} else {
		puthelp "PRIVMSG $chan :Couldn't contact the server, please check the configuration and/or streaming server"
	}
   }
}

bind pub -|- !genre get_shoutcast_genre 
proc get_shoutcast_genre {nick uhost hand chan arg} {
   global url streamch
   set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} { 
   	set http_req [::http::geturl $url -timeout 2000]
	if {[::http::status $http_req] != "ok"} {
		puthelp "PRIVMSG $chan :Stream is unavailable";
	}
	set data [::http::data $http_req]
	::http::cleanup $http_req
	if {[regexp {<font class=default>Stream Genre: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
		puthelp "PRIVMSG $chan :\002Genre\002: $title"
	} else {
		puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
		get_shoutcast_server $nick $uhost $hand $chan $arg
	}
   }
}

bind pub -|- !status get_shoutcast_status
proc get_shoutcast_status {nick uhost hand chan arg} {
   global url streamch
   set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} { 
   	set http_req [::http::geturl $url -timeout 2000]
	if {[::http::status $http_req] != "ok"} {
		puthelp "PRIVMSG $chan :Stream is unavailable";
	}
	set data [::http::data $http_req]
	::http::cleanup $http_req
	if {[regexp {B>([^<]+) of} $data x title]} {
		regexp { of ([^<]+) listeners} $data x title2
		regexp {listeners ([^<]+)} $data x title3
		regexp {Stream is up at ([^<]+) with} $data x title4
		puthelp "PRIVMSG $chan :\002Status\002: $title of $title2 $title3 at $title4"
	} else {
		puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
		get_shoutcast_server $nick $uhost $hand $chan $arg
	}
   }
}

bind pub -|- !record get_shoutcast_peak
proc get_shoutcast_peak {nick uhost hand chan arg} {
   global url streamch
   set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} { 
   	set http_req [::http::geturl $url -timeout 2000]
	if {[::http::status $http_req] != "ok"} {
		puthelp "PRIVMSG $chan :Stream is unavailable";
	}
	set data [::http::data $http_req]
	::http::cleanup $http_req
	if {[regexp {<font class=default>Listener Peak: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
		puthelp "PRIVMSG $chan :\002Record\002: $title"
	} else {
		puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
		get_shoutcast_server $nick $uhost $hand $chan $arg
	}
   }
}

bind pub -|- !listen get_shoutcast_listen
proc get_shoutcast_listen {nick uhost hand chan arg} {
   global url streamch playlist
   set streamch [string tolower $streamch]
   if {[string tolower $chan] == "$streamch"} {
	if {$playlist == ""} {
		puthelp "PRIVMSG $chan :\002Stream/Listen\002: $url/listen.pls"
	} else { 
		puthelp "PRIVMSG $chan :\002Stream/Listen\002: $playlist"
	}
   }
}

bind pub -|- !icq get_shoutcast_icq 
proc get_shoutcast_icq {nick uhost hand chan arg} {
   global url streamch
   set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} { 
   	set http_req [::http::geturl $url -timeout 2000]
	if {[::http::status $http_req] != "ok"} {
		puthelp "PRIVMSG $chan :Stream is unavailable";
	}
	set data [::http::data $http_req]
	::http::cleanup $http_req
	if {[regexp {<font class=default>Stream ICQ: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
		puthelp "PRIVMSG $chan :\002ICQ\002: $title"
	} else {
		puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
		get_shoutcast_server $nick $uhost $hand $chan $arg
	}
   }
}

bind pub -|- !aim get_shoutcast_aim 
proc get_shoutcast_aim {nick uhost hand chan arg} {
   global url streamch
   set streamch [string tolower $streamch]
   ::http::config -useragent "Mozilla/5.0; Shoutinfo"
   if {[string tolower $chan] == "$streamch"} { 
   	set http_req [::http::geturl $url -timeout 2000]
	if {[::http::status $http_req] != "ok"} {
		puthelp "PRIVMSG $chan :Stream is unavailable";
	}
	set data [::http::data $http_req]
	::http::cleanup $http_req
	if {[regexp {<font class=default>Stream AIM: </font></td><td><font class=default><b>([^<]+)</b>} $data x title]} {
		puthelp "PRIVMSG $chan :\002AIM\002: $title"
	} else {
		puthelp "PRIVMSG $chan :Couldn't receive any information, checking server status..."
		get_shoutcast_server $nick $uhost $hand $chan $arg
	}
   }
}

bind pub -|- !request get_shoutcast_request
proc get_shoutcast_request {nick uhost hand chan arg} {
   global streamch djch
   set streamch [string tolower $streamch]
   if {[string tolower $chan] == "$streamch"} {
	puthelp "PRIVMSG $djch :\002\Request\002: $arg  - Requested by: \002$nick\002"
	puthelp "NOTICE $nick :\002$arg\002 is succesfully requested"
   }
}
thx advanced
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

See this topic http://forum.egghelp.org/viewtopic.php?t=19283 it does what you want. Every channel cna have its one radio station.
Post Reply