-- ShoutStats 1.0 -- -- by Mutor The Ugly -- Requested By Bastya_Elvtars -- -- ShoutCAST Status Grabber -- Grabs the current stream info -- Return to user or send to all -- -- Bug fix by Mutor 10/8/04 -- Fixed double url... -- --User Settings------------------------------------------------------------------------------------- Bot = "[ShoutCastStats]" --Name for bot Command1 = "+sr" --Get status now Command2 = "+srall" --Toggle send to all on/off ghostin = "http://207.218.206.15" --SHOUTcast D.N.A.S. Status Address gport = 1280 --Port to connect to gfile = "/index.html" --default file for web page Send2Main = "no" --Send results to all users? 'yes/no' --End User Settings---------------------------------------------------------------------------------- -- function GetNews(user, data) ghost = ghostin ghost = gsub(ghost, "http://","") ghost = gsub(ghost, "HTTP://","") GETHTML = "GET "..gfile.." HTTP/1.1\r\nHost: "..ghost.."\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" local socket, err = connect(ghost, gport) if socket == nil then local dsp2 dsp2 = "\r\n\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n" dsp2 = dsp2.."\t >Connect Status:\t **Failed! - Unable To Connect\r\n" dsp2 = dsp2.."\t >Failure Cause:\t Bad Address or Port Number\r\n" dsp2 = dsp2.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n" user:SendData(Bot,dsp2) return 1 end local code = "" if not err then socket:timeout(4) socket:send(GETHTML..strchar(13,10)) local line = "" while not err do line, err = socket:receive("*l") code = code..line x = gsub(code, "^(.+)%s*
Current Stream Information","") x = gsub(x, "Average","Avg%.") x = gsub(x, "(%s+)Written","") x = gsub(x, "Current Song%s.+(<%/td>.+)","") x = gsub(x, "