Party hhc: added max seats recognition

This commit is contained in:
grindi 2009-08-09 16:38:55 +04:00
parent ebbb2afcd3
commit 730c82bc95

View File

@ -88,6 +88,7 @@ class PartyPoker(HandHistoryConverter):
""", """,
re.MULTILINE|re.VERBOSE) re.MULTILINE|re.VERBOSE)
re_TotalPlayers = re.compile("^Total\s+number\s+of\s+players\s*:\s*(?P<MAXSEATS>\d+)", re.MULTILINE)
re_SplitHands = re.compile('\x00+') re_SplitHands = re.compile('\x00+')
re_TailSplitHands = re.compile('(\x00+)') re_TailSplitHands = re.compile('(\x00+)')
lineSplitter = '\n' lineSplitter = '\n'
@ -112,6 +113,8 @@ follow : whether to tail -f the input"""
def allHandsAsList(self): def allHandsAsList(self):
list = HandHistoryConverter.allHandsAsList(self) list = HandHistoryConverter.allHandsAsList(self)
if list is None:
return None
return filter(lambda text: len(text.strip()), list) return filter(lambda text: len(text.strip()), list)
def compilePlayerRegexs(self, hand): def compilePlayerRegexs(self, hand):
@ -249,6 +252,9 @@ follow : whether to tail -f the input"""
m = self.re_Hid.search(hand.handText) m = self.re_Hid.search(hand.handText)
if m: info.update(m.groupdict()) if m: info.update(m.groupdict())
m = self.re_TotalPlayers.search(hand.handText)
if m: info.update(m.groupdict())
# FIXME: it's a hack cause party doesn't supply hand.maxseats info # FIXME: it's a hack cause party doesn't supply hand.maxseats info
#hand.maxseats = ??? #hand.maxseats = ???
hand.mixed = None hand.mixed = None
@ -281,6 +287,8 @@ follow : whether to tail -f the input"""
#FIXME: it's dirty hack T_T #FIXME: it's dirty hack T_T
cur = info[key][0] if info[key][0] not in '0123456789' else '' cur = info[key][0] if info[key][0] not in '0123456789' else ''
hand.buyin = info[key] + '+%s0' % cur hand.buyin = info[key] + '+%s0' % cur
if key == 'MAXSEATS':
hand.maxseats = int(info[key])
if key == 'LEVEL': if key == 'LEVEL':
hand.level = info[key] hand.level = info[key]
if key == 'PLAY' and info['PLAY'] != 'Real': if key == 'PLAY' and info['PLAY'] != 'Real':