Player regex interface updates from monkeyfutz
This commit is contained in:
parent
50a1ec1ccf
commit
c505e98bcf
|
@ -47,9 +47,12 @@ class Everleaf(HandHistoryConverter):
|
|||
except:
|
||||
self.ofile = os.path.join(self.hhdir, "x"+strftime("%d-%m-%y")+os.path.basename(file))
|
||||
|
||||
def compilePlayerRegexs(self):
|
||||
player_re = "(?P<PNAME>" + "|".join(map(re.escape, self.players)) + ")"
|
||||
#print "DEBUG player_re: " + player_re
|
||||
def compilePlayerRegexs(self, players):
|
||||
if not players <= self.compiledPlayers: # x <= y means 'x is subset of y'
|
||||
# we need to recompile the player regexs.
|
||||
self.compiledPlayers = players
|
||||
player_re = "(?P<PNAME>" + "|".join(map(re.escape, players)) + ")"
|
||||
logging.debug("player_re: "+ player_re)
|
||||
self.re_PostSB = re.compile(r"^%s: posts small blind \[\$? (?P<SB>[.0-9]+)" % player_re, re.MULTILINE)
|
||||
self.re_PostBB = re.compile(r"^%s: posts big blind \[\$? (?P<BB>[.0-9]+)" % player_re, re.MULTILINE)
|
||||
self.re_PostBoth = re.compile(r"^%s: posts both blinds \[\$? (?P<SBBB>[.0-9]+)" % player_re, re.MULTILINE)
|
||||
|
|
|
@ -39,9 +39,12 @@ class FullTilt(HandHistoryConverter):
|
|||
self.sitename = "FullTilt"
|
||||
self.setFileType("text", "cp1252")
|
||||
|
||||
def compilePlayerRegexs(self):
|
||||
player_re = "(?P<PNAME>" + "|".join(map(re.escape, self.players)) + ")"
|
||||
print "DEBUG player_re: " + player_re
|
||||
def compilePlayerRegexs(self, players):
|
||||
if not players <= self.compiledPlayers: # x <= y means 'x is subset of y'
|
||||
# we need to recompile the player regexs.
|
||||
self.compiledPlayers = players
|
||||
player_re = "(?P<PNAME>" + "|".join(map(re.escape, players)) + ")"
|
||||
logging.debug("player_re: " + player_re)
|
||||
self.re_PostSB = re.compile(r"^%s posts the small blind of \$?(?P<SB>[.0-9]+)" % player_re, re.MULTILINE)
|
||||
self.re_PostBB = re.compile(r"^%s posts (the big blind of )?\$?(?P<BB>[.0-9]+)" % player_re, re.MULTILINE)
|
||||
self.re_Antes = re.compile(r"^%s antes \$?(?P<ANTE>[.0-9]+)" % player_re, re.MULTILINE)
|
||||
|
|
|
@ -92,6 +92,7 @@ class HandHistoryConverter:
|
|||
self.ofile = os.path.join(self.hhdir, os.path.basename(file))
|
||||
self.rexx = FpdbRegex.FpdbRegex()
|
||||
self.players = set()
|
||||
self.compiledPlayers = set()
|
||||
self.maxseats = 10
|
||||
|
||||
def __str__(self):
|
||||
|
@ -118,7 +119,7 @@ class HandHistoryConverter:
|
|||
return
|
||||
|
||||
self.obs = self.obs.replace('\r\n', '\n')
|
||||
self.gametype = self.determineGameType()
|
||||
self.gametype = self.determineGameType(self.obs)
|
||||
if self.gametype == None:
|
||||
print "Unknown game type from file, aborting on this file."
|
||||
return
|
||||
|
@ -138,7 +139,7 @@ class HandHistoryConverter:
|
|||
else:
|
||||
# we need to recompile the player regexs.
|
||||
self.players = playersThisHand
|
||||
self.compilePlayerRegexs()
|
||||
self.compilePlayerRegexs(playersThisHand)
|
||||
|
||||
self.markStreets(hand)
|
||||
# Different calls if stud or holdem like
|
||||
|
|
Loading…
Reference in New Issue
Block a user