Fix some bugs in BetfairToFpdb.

As reported by tchaz on 2+2:

http://forumserver.twoplustwo.com/showpost.php?p=13870274&postcount=1960

Using the only sample file I have for Betfair, it appears there is still and accounting error
This commit is contained in:
Worros 2009-10-18 07:56:34 +08:00
parent 639036871b
commit cfc854ab50

View File

@ -105,7 +105,7 @@ class Betfair(HandHistoryConverter):
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE'))) logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
hand.handid = m.group('HID') hand.handid = m.group('HID')
hand.tablename = m.group('TABLE') hand.tablename = m.group('TABLE')
hand.starttime = time.strptime(m.group('DATETIME'), "%A, %B %d, %H:%M:%S GMT %Y") hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%A, %B %d, %H:%M:%S GMT %Y")
#hand.buttonpos = int(m.group('BUTTON')) #hand.buttonpos = int(m.group('BUTTON'))
def readPlayerStacks(self, hand): def readPlayerStacks(self, hand):
@ -144,6 +144,7 @@ class Betfair(HandHistoryConverter):
def readAntes(self, hand): def readAntes(self, hand):
logging.debug("reading antes") logging.debug("reading antes")
m = self.re_Antes.finditer(hand.handText)
for player in m: for player in m:
logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE'))) logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE')))
hand.addAnte(player.group('PNAME'), player.group('ANTE')) hand.addAnte(player.group('PNAME'), player.group('ANTE'))
@ -160,17 +161,15 @@ class Betfair(HandHistoryConverter):
hand.buttonpos = int(self.re_Button.search(hand.handText).group('BUTTON')) hand.buttonpos = int(self.re_Button.search(hand.handText).group('BUTTON'))
def readHeroCards(self, hand): def readHeroCards(self, hand):
m = self.re_HeroCards.search(hand.handText) # streets PREFLOP, PREDRAW, and THIRD are special cases beacause
if(m == None): # we need to grab hero's cards
#Not involved in hand for street in ('PREFLOP', 'DEAL'):
hand.involved = False if street in hand.streets.keys():
else: m = self.re_HeroCards.finditer(hand.streets[street])
hand.hero = m.group('PNAME') for found in m:
# "2c, qh" -> set(["2c","qc"]) hand.hero = found.group('PNAME')
# Also works with Omaha hands. newcards = [c.strip() for c in found.group('CARDS').split(',')]
cards = m.group('CARDS') hand.addHoleCards(street, hand.hero, closed=newcards, shown=False, mucked=False, dealt=True)
cards = [c.strip() for c in cards.split(',')]
hand.addHoleCards(cards, m.group('PNAME'))
def readStudPlayerCards(self, hand, street): def readStudPlayerCards(self, hand, street):
# balh blah blah # balh blah blah