From: Andy Spencer Date: Fri, 22 Jun 2012 20:56:37 +0000 (+0000) Subject: update sfvlug, avoid excess topic setting X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;ds=sidebyside;h=e6cdf078d6266482e89c645f0a45eba7abbaccf1;p=~andy%2Frhawk update sfvlug, avoid excess topic setting --- diff --git a/rhawk b/rhawk index 34a1ad5..62c1bc9 100755 --- a/rhawk +++ b/rhawk @@ -80,15 +80,19 @@ BEGIN { pollchan = "#sfvlug" } debug("Unknown topic for " pollchan); next } - cmd = "curl -s http://sfvlug.org/" - day = "(Sun|Mon|Tue|Wed|Thu|Fri|Sat)" - web = "next meeting.*" day "\\w+[, ]+([A-Z]\\w+) +([0-9]+)[, ]+([0-9]+)" - irc = day "\\w*[, ]+([A-Z]\\w+) +([0-9]+)" - while (cmd | getline line) { - if (match(line, web, arr)) { - new = arr[1] " " arr[2] " " arr[3] - sub(irc, new, topics[pollchan]) - topic(pollchan, topics[pollchan]) + _curl = "curl -s http://sfvlug.org/" + _day = "(Sun|Mon|Tue|Wed|Thu|Fri|Sat)" + _web_ptrn = "next meeting.*" _day "\\w+[, ]+([A-Z]\\w+) +([0-9]+)[, ]+([0-9]+)" + _irc_ptrn = _day "\\w*[, ]+([A-Z]\\w+) +([0-9]+)" + while (_curl | getline _line) { + if (match(_line, _web_ptrn, _parts)) { + _date = _parts[1] " " _parts[2] " " _parts[3] + _topic = topics[pollchan] + sub(_irc_ptrn, _date, _topic) + if (_topic != topics[pollchan]) + topic(pollchan, topics[pollchan] = _topic) + else + debug("topic is already correct") break } }