From 8c27ab7917720298b48c863e406c7c299dfcca41 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 22 Mar 2003 03:15:12 +0000 Subject: [PATCH] Slightly changed format of gameknot URL snarfer --- plugins/Forums.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/Forums.py b/plugins/Forums.py index 66730f67f..cc173c271 100644 --- a/plugins/Forums.py +++ b/plugins/Forums.py @@ -37,7 +37,6 @@ import urllib2 import debug import ircmsgs import ircutils -import ircutils import callbacks htmlStripper = re.compile(r'<[^>]+>') @@ -67,8 +66,12 @@ class Forums(callbacks.PrivmsgRegexp): _gkRating = re.compile(r": (\d+)[^:]+:
(\d+)[^,]+, (\d+)[^,]+, (\d+)") def gameknot(self, irc, msg, match): r"http://(?:www\.)?gameknot.com/chess.pl\?bd=\d+&r=\d+" - fd = urllib2.urlopen(match.group(0)) + #debug.printf('Got a GK URL from %s' % msg.prefix) + url = match.group(0) + fd = urllib2.urlopen(url) + #debug.printf('Got the connection.') s = fd.read() + #debug.printf('Got the string.') fd.close() try: ((wRating, wName), (bRating, bName)) = self._gkPlayer.findall(s) @@ -81,8 +84,7 @@ class Forums(callbacks.PrivmsgRegexp): wStats = '%s; W-%s, L-%s, D-%s' % (wRating, wWins, wLosses, wDraws) bStats = '%s; W-%s, L-%s, D-%s' % (bRating, bWins, bLosses, bDraws) irc.queueMsg(ircmsgs.privmsg(msg.args[0], - '%s (%s) vs. %s (%s)' % (wName, wStats, bName, bStats))) - + '%s (%s) vs. %s (%s) [%s]' % (wName,wStats,bName,bStats,url))) except ValueError: irc.queueMsg(ircmsgs.privmsg(msg.args[0], 'That doesn\'t appear to be a proper Gameknot game.'))