From bb2104e5f8f9541d4435717a3deb4b4c25f9ac2e Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 12 Mar 2009 18:38:48 +0900 Subject: [PATCH] First successful Betfair import --- pyfpdb/BetfairToFpdb.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pyfpdb/BetfairToFpdb.py b/pyfpdb/BetfairToFpdb.py index e532b86b..bc1d17c9 100755 --- a/pyfpdb/BetfairToFpdb.py +++ b/pyfpdb/BetfairToFpdb.py @@ -54,15 +54,15 @@ follow : whether to tail -f the input""" self.compiledPlayers = players player_re = "(?P" + "|".join(map(re.escape, players)) + ")" logging.debug("player_re: " + player_re) - self.re_PostSB = re.compile("^%s: posts small blind \[\$? (?P[.0-9]+)" % player_re, re.MULTILINE) - self.re_PostBB = re.compile("^%s: posts big blind \[\$? (?P[.0-9]+)" % player_re, re.MULTILINE) + self.re_PostSB = re.compile("^%s posts small blind \[\$?(?P[.0-9]+)" % player_re, re.MULTILINE) + self.re_PostBB = re.compile("^%s posts big blind \[\$?(?P[.0-9]+)" % player_re, re.MULTILINE) self.re_Antes = re.compile("^%s antes asdf sadf sadf" % player_re, re.MULTILINE) self.re_BringIn = re.compile("^%s antes asdf sadf sadf" % player_re, re.MULTILINE) - self.re_PostBoth = re.compile("^%s: posts small \& big blinds \[\$? (?P[.0-9]+)" % player_re, re.MULTILINE) + self.re_PostBoth = re.compile("^%s posts small \& big blinds \[\$?(?P[.0-9]+)" % player_re, re.MULTILINE) self.re_HeroCards = re.compile("^Dealt to %s \[ (?P.*) \]" % player_re, re.MULTILINE) - self.re_Action = re.compile("^%s: (?Pbets|checks|raises|calls|folds)(\s\[\$ (?P[.\d]+) (USD|EUR)\])?" % player_re, re.MULTILINE) + self.re_Action = re.compile("^%s (?Pbets|checks|raises to|raises|calls|folds)(\s\[\$(?P[.\d]+)\])?" % player_re, re.MULTILINE) self.re_ShowdownAction = re.compile("^%s shows \[ (?P.*) \]" % player_re, re.MULTILINE) - self.re_CollectPot = re.compile("^%s wins \$ (?P[.\d]+) (USD|EUR)(.*?\[ (?P.*?) \])?" % player_re, re.MULTILINE) + self.re_CollectPot = re.compile("^%s wins \$(?P[.\d]+) (.*?\[ (?P.*?) \])?" % player_re, re.MULTILINE) self.re_SitsOut = re.compile("^%s sits out" % player_re, re.MULTILINE) self.re_ShownCards = re.compile(r"%s (?P[0-9]+) (?Padsfasdf)" % player_re, re.MULTILINE) @@ -186,18 +186,18 @@ follow : whether to tail -f the input""" def readAction(self, hand, street): m = self.re_Action.finditer(hand.streets[street]) for action in m: - if action.group('ATYPE') == ' raises to': + if action.group('ATYPE') == 'raises to': hand.addRaiseTo( street, action.group('PNAME'), action.group('BET') ) # elif action.group('ATYPE') == ' completes it to': # hand.addComplete( street, action.group('PNAME'), action.group('BET') ) -# elif action.group('ATYPE') == ' calls': -# hand.addCall( street, action.group('PNAME'), action.group('BET') ) -# elif action.group('ATYPE') == ' bets': -# hand.addBet( street, action.group('PNAME'), action.group('BET') ) -# elif action.group('ATYPE') == ' folds': -# hand.addFold( street, action.group('PNAME')) -# elif action.group('ATYPE') == ' checks': -# hand.addCheck( street, action.group('PNAME')) + elif action.group('ATYPE') == 'calls': + hand.addCall( street, action.group('PNAME'), action.group('BET') ) + elif action.group('ATYPE') == 'bets': + hand.addBet( street, action.group('PNAME'), action.group('BET') ) + elif action.group('ATYPE') == 'folds': + hand.addFold( street, action.group('PNAME')) + elif action.group('ATYPE') == 'checks': + hand.addCheck( street, action.group('PNAME')) else: print "DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),)