Merge branch 'master' of git://git.assembla.com/fpdboz.git

This commit is contained in:
eblade 2009-02-21 09:39:33 -05:00
commit 560bead1d3
4 changed files with 17 additions and 7 deletions

View File

@ -88,7 +88,7 @@ class Everleaf(HandHistoryConverter):
print "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 small \& big blinds \[\$? (?P<SBBB>[.0-9]+)" % player_re, re.MULTILINE)
self.re_PostBoth = re.compile(r"^%s: posts both blinds \[\$? (?P<SBBB>[.0-9]+)" % player_re, re.MULTILINE)
self.re_HeroCards = re.compile(r"^Dealt to %s \[ (?P<CARDS>.*) \]" % player_re, re.MULTILINE)
self.re_Action = re.compile(r"^%s(?P<ATYPE>: bets| checks| raises| calls| folds)(\s\[\$ (?P<BET>[.\d]+) (USD|EUR)\])?" % player_re, re.MULTILINE)
self.re_ShowdownAction = re.compile(r"^%s shows \[ (?P<CARDS>.*) \]" % player_re, re.MULTILINE)
@ -108,6 +108,8 @@ class Everleaf(HandHistoryConverter):
def readHandInfo(self, hand):
m = self.re_HandInfo.search(hand.string)
if(m == None):
print "DEBUG: re_HandInfo.search failed: '%s'" %(hand.string)
hand.handid = m.group('HID')
hand.tablename = m.group('TABLE')
# These work, but the info is already in the Hand class - should be used for tourneys though.
@ -162,7 +164,7 @@ class Everleaf(HandHistoryConverter):
for a in self.re_PostBB.finditer(hand.string):
hand.addBlind(a.group('PNAME'), 'big blind', a.group('BB'))
for a in self.re_PostBoth.finditer(hand.string):
hand.addBlind(a.group('PNAME'), 'small & big blinds', a.group('SBBB'))
hand.addBlind(a.group('PNAME'), 'both', a.group('SBBB'))
def readHeroCards(self, hand):
m = self.re_HeroCards.search(hand.string)

View File

@ -223,6 +223,7 @@ if __name__ == '__main__':
#Do something useful
importer = fpdb_import.Importer(False,settings, config)
importer.setDropIndexes("auto")
importer.setFailOnError(True)
importer.addImportFile(options.filename)
importer.setCallHud(False)
importer.runImport()

View File

@ -191,7 +191,7 @@ Card ranks will be uppercased
# - this is a bet of 1 bb and is the new uncalled
#
# If a player posts a big & small blind
#
# - FIXME: We dont record this for later printing yet
print "DEBUG addBlind: %s posts %s, %s" % (player, blindtype, amount)
if player is not None:
@ -203,10 +203,11 @@ Card ranks will be uppercased
self.pot.addMoney(player, Decimal(amount))
if blindtype == 'big blind':
self.lastBet['PREFLOP'] = Decimal(amount)
elif blindtype == 'small & big blinds':
elif blindtype == 'both':
# extra small blind is 'dead'
self.lastBet['PREFLOP'] = Decimal(self.bb)
self.posted += [player]
print "DEBUG: self.posted: %s" %(self.posted)
def addCall(self, street, player=None, amount=None):
@ -389,7 +390,7 @@ Map the tuple self.gametype onto the pokerstars string describing it
#May be more than 1 bb posting
for a in self.posted[1:]:
print >>fh, _("%s: posts big blind $%s" %(self.posted[1], self.bb))
print >>fh, _("%s: posts big blind $%s" %(a, self.bb))
# TODO: What about big & small blinds?
@ -599,8 +600,11 @@ class Pot(object):
return "Total pot $%.2f Main pot $%.2f. Side pot $%2.f." % (self.total, self.pots[0], self.pots[1])
elif len(self.pots) == 3:
return "Total pot $%.2f Main pot $%.2f. Side pot-1 $%2.2f. Side pot-2 $%.2f." % (self.total, self.pots[0], self.pots[1], self.pots[2])
elif len(self.pots) == 0:
# no small blind and walk in bb (hopefully)
return "Total pot $%.2f" % (self.total,)
else:
return "maybe no pot.. or too many pots.. no small blind and walk in bb?."
return _("too many pots.. no small blind and walk in bb?. self.pots: %s" %(self.pots))
# I don't know stars format for a walk in the bb when sb doesn't post.
# The thing to do here is raise a Hand error like fpdb import does and file it into errors.txt

View File

@ -89,7 +89,6 @@ class HandHistoryConverter:
self.hhdir = os.path.join(self.hhbase,sitename)
self.gametype = []
self.ofile = os.path.join(self.hhdir, os.path.basename(file))
print self.ofile
self.rexx = FpdbRegex.FpdbRegex()
self.players = set()
@ -238,6 +237,10 @@ class HandHistoryConverter:
else:
print "HH Sanity Check: Directory hhdir '" + self.hhdir + "' or its parent directory are not writable"
# Make sure input and output files are different or we'll overwrite the source file
if(self.ofile == self.file):
print "HH Sanity Check: output and input files are the same, check config"
return sane
# Functions not necessary to implement in sub class