Skip to content
Snippets Groups Projects
Commit 9dea4d19 authored by deuce's avatar deuce
Browse files

Add 10min/hr/day change stats.

parent 53968a25
No related branches found
No related tags found
No related merge requests found
......@@ -854,11 +854,14 @@ Bot_Commands["BANDS"].usage = get_cmd_prefix() + "BANDS [band]";
Bot_Commands["BANDS"].help = "Displays the current band conditions";
Bot_Commands["BANDS"].command = function (target,onick,ouh,srv,lvl,cmd) {
var band;
var b;
var i;
var req;
var resp;
var m;
var re;
var uri;
var cond = {};
// Remove empty cmd args
for (i=1; i<cmd.length; i++) {
......@@ -879,27 +882,53 @@ Bot_Commands["BANDS"].command = function (target,onick,ouh,srv,lvl,cmd) {
function condx(val) {
var v = parseInt(val, 10);
if (v >= 100)
return "\x031,9QRP\x03";
return "QRP";
if (v >= 70)
return "\x030,3Barefoot\x03";
return "Barefoot";
if (v >= 51)
return "\x031,8AMP, High lobe\x03";
return "AMP, High lobe";
if (v >= 36)
return "\x030,7AMP, Low lobe\x03";
return "AMP, Low lobe";
if (v >= 19)
return "\x030,4NVIS\x03";
return "\x030,5Groundwave ONLY\x03";
return "NVIS";
return "Groundwave ONLY";
}
function change(r, slash) {
var ch;
re = /^([0-9]{1,3})\<IMG SRC="http:\/\/www\.bandcondx\.com\/TRENDS\/(-?[0-9]{1,3})\.JPG/ym;
while ((m = re.exec(r)) != null) {
ch = parseInt(m[2], 10);
cond[m[1]] += format("% 3d", m[2]);
if (slash)
cond[m[1]] += '/'
else
cond[m[1]] += ')'
}
}
req = new HTTPRequest();
resp = req.Get("http://www.bandconditions.com/");
m = resp.match(/frame src="([^"]*)"/);
if (m != null) {
resp = req.Get(m[1]);
uri = m[1];
resp = req.Get(uri);
re = /^([0-9]{1,3})\<IMG SRC="http:\/\/www\.bandcondx\.com\/([0-9]{1,3})\.jpg/ym;
while ((m = re.exec(resp)) != null) {
if (band === undefined || band == m[1])
srv.o(target, m[1]+"m: "+condx(m[2]));
cond[m[1]] = format("% 4d: %-20.20s (", m[1]+'m', condx(m[2]));
i = parseInt(m[2], 10);
}
resp = req.Get(uri.replace(/[^\/]*$/, '10MIN.htm'));
change(resp, true);
resp = req.Get(uri.replace(/[^\/]*$/, '1HR.htm'));
change(resp, true);
resp = req.Get(uri.replace(/[^\/]*$/, '24HRS.htm'));
change(resp, false);
srv.o(target, 'Band: Usage (10m/hr /day change)');
for (b in cond) {
if (band === undefined || band == b)
srv.o(target, cond[b]);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment