From 822546da7bf8e175523d18d63a4dafe886e007e8 Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Sat, 14 Mar 2009 12:44:14 +0000 Subject: [PATCH 1/5] blinds can be all in. --- pyfpdb/Hand.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index d5912f60..098dc88f 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -151,7 +151,7 @@ If a player has None chips he won't be added.""" elif blindtype == 'both': # extra small blind is 'dead' self.lastBet['PREFLOP'] = Decimal(self.bb) - self.posted = self.posted + [[player,blindtype]] + self.posted = self.posted + [[player,blindtype]] #print "DEBUG: self.posted: %s" %(self.posted) @@ -364,11 +364,11 @@ Map the tuple self.gametype onto the pokerstars string describing it print >>fh, _("%s: completes to $%s%s" %(act[0], act[2], ' and is all-in' if act[3] else '')) elif act[1] == 'posts': if(act[2] == "small blind"): - print >>fh, _("%s: posts small blind $%s" %(act[0], act[3])) + print >>fh, _("%s: posts small blind $%s%s" %(act[0], act[3], ' and is all-in' if act[4] else '')) elif(act[2] == "big blind"): - print >>fh, _("%s: posts big blind $%s" %(act[0], act[3])) + print >>fh, _("%s: posts big blind $%s%s" %(act[0], act[3], ' and is all-in' if act[4] else '')) elif(act[2] == "both"): - print >>fh, _("%s: posts small & big blinds $%s" %(act[0], act[3])) + print >>fh, _("%s: posts small & big blinds $%s%s" %(act[0], act[3], ' and is all-in' if act[4] else '')) elif act[1] == 'bringin': print >>fh, _("%s: brings in for $%s%s" %(act[0], act[2], ' and is all-in' if act[3] else '')) class HoldemOmahaHand(Hand): From 547ffd0e41ec7554a28dde79509ea6df9cf0285d Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Sat, 14 Mar 2009 13:45:09 +0000 Subject: [PATCH 2/5] tiny output bugs fixed. --- pyfpdb/Hand.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 11927587..595bc49c 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -336,7 +336,7 @@ Map the tuple self.gametype onto the pokerstars string describing it # currently it appears to be something like ["ring", "hold", "nl", sb, bb]: gs = {"holdem" : "Hold'em", "omahahi" : "Omaha", - "omahahilo" : "FIXME", + "omahahilo" : "Omaha Hi/Lo", "razz" : "Razz", "studhi" : "7 Card Stud", "studhilo" : "FIXME", @@ -463,7 +463,7 @@ Card ranks will be uppercased def writeHand(self, fh=sys.__stdout__): # PokerStars format. - print >>fh, _("%s Game #%s: %s ($%s/$%s) - %s" %("PokerStars", self.handid, self.getGameTypeAsString(), self.sb, self.bb, time.strftime('%Y/%m/%d - %H:%M:%S (ET)', self.starttime))) + print >>fh, _("%s Game #%s: %s ($%s/$%s) - %s" %("PokerStars", self.handid, self.getGameTypeAsString(), self.sb, self.bb, time.strftime('%Y/%m/%d - %H:%M:%S ET', self.starttime))) print >>fh, _("Table '%s' %d-max Seat #%s is the button" %(self.tablename, self.maxseats, self.buttonpos)) players_who_act_preflop = set(([x[0] for x in self.actions['PREFLOP']]+[x[0] for x in self.actions['BLINDSANTES']])) @@ -642,14 +642,14 @@ Card ranks will be uppercased def writeHand(self, fh=sys.__stdout__): # PokerStars format. - print >>fh, _("%s Game #%s: %s ($%s/$%s) - %s" %("PokerStars", self.handid, self.getGameTypeAsString(), self.sb, self.bb, time.strftime('%Y/%m/%d - %H:%M:%S (ET)', self.starttime))) + print >>fh, _("%s Game #%s: %s ($%s/$%s) - %s" %("PokerStars", self.handid, self.getGameTypeAsString(), self.sb, self.bb, time.strftime('%Y/%m/%d %H:%M:%S ET', self.starttime))) print >>fh, _("Table '%s' %d-max Seat #%s is the button" %(self.tablename, self.maxseats, self.buttonpos)) players_who_act_ondeal = set(([x[0] for x in self.actions['DEAL']]+[x[0] for x in self.actions['BLINDSANTES']])) for player in [x for x in self.players if x[1] in players_who_act_ondeal]: #Only print stacks of players who do something on deal - print >>fh, _("Seat %s: %s ($%s)" %(player[0], player[1], player[2])) + print >>fh, _("Seat %s: %s ($%s in chips) " %(player[0], player[1], player[2])) if 'BLINDSANTES' in self.actions: for act in self.actions['BLINDSANTES']: From 51444f2ac49b94f2dca3e5121fbb5bc549ffeac2 Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Sat, 14 Mar 2009 15:02:23 +0000 Subject: [PATCH 3/5] print a showdown section if anyone showed any kind of hand (obv logic not 100%, people can show cards without a showdown, but legacy importer expects cards there, right?) slight change to get through the horse test file --- pyfpdb/Hand.py | 7 ++++--- pyfpdb/HandHistoryConverter.py | 17 +++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index b0512c44..7f560ebc 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -501,10 +501,11 @@ Card ranks will be uppercased #Some sites don't have a showdown section so we have to figure out if there should be one # The logic for a showdown is: at the end of river action there are at least two players in the hand # we probably don't need a showdown section in pseudo stars format for our filtering purposes - if 'SHOWDOWN' in self.actions: + if self.shown: print >>fh, _("*** SHOW DOWN ***") - #TODO: Complete SHOWDOWN - + for name in self.shown: + print >>fh, _("%s shows [%s] (a hand...)" % (name, " ".join(self.holecards[name]['PREFLOP']))) + # Current PS format has the lines: # Uncalled bet ($111.25) returned to s0rrow # s0rrow collected $5.15 from side pot diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 23688700..98a96638 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -204,12 +204,17 @@ Tail the in_path file and yield handTexts separated by re_SplitHands""" def processHand(self, handText): gametype = self.determineGameType(handText) logging.debug("gametype %s" % gametype) - - # See if gametype is supported. - type = gametype['type'] - base = gametype['base'] - limit = gametype['limitType'] - l = [type] + [base] + [limit] + if gametype is None: + l = None + gametype = "unmatched" + # TODO: not ideal, just trying to not error. + # TODO: Need to count failed hands. + else: + # See if gametype is supported. + type = gametype['type'] + base = gametype['base'] + limit = gametype['limitType'] + l = [type] + [base] + [limit] hand = None if l in self.readSupportedGames(): hand = None From cfbdff5159c8d26bbb21d601fee259502f3ca204 Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Sun, 15 Mar 2009 16:50:59 +0000 Subject: [PATCH 4/5] add -x command line option to specify converter usage: ./GuiBulkImport -q -f lala.txt -x EverleafToFpdb --- pyfpdb/GuiBulkImport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py index 6105e443..509c9f61 100755 --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -213,7 +213,7 @@ if __name__ == '__main__': parser = OptionParser() parser.add_option("-f", "--file", dest="filename", help="Input file in quiet mode", metavar="FILE") parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True, help="don't start gui") - + parser.add_option("-x", "--convert", dest="filtername", help="Conversion filter", default="passthrough") (options, sys.argv) = parser.parse_args() config = Configuration.Config() @@ -240,7 +240,7 @@ if __name__ == '__main__': importer = fpdb_import.Importer(False,settings, config) importer.setDropIndexes("auto") importer.setFailOnError(True) - importer.addImportFile(options.filename) + importer.addImportFile(options.filename, filter=options.filtername) importer.setCallHud(False) importer.runImport() importer.clearFileList() From 08dae30f1f41116f0b614710cb50c91a09524030 Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Sun, 15 Mar 2009 16:51:50 +0000 Subject: [PATCH 5/5] Ensure both holecards are known (holdem) or all four (omaha) before printing a 'shows hand' line : not ideal, but legacy importer chokes otherwise --- pyfpdb/Hand.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 7f560ebc..45068c17 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -504,7 +504,15 @@ Card ranks will be uppercased if self.shown: print >>fh, _("*** SHOW DOWN ***") for name in self.shown: - print >>fh, _("%s shows [%s] (a hand...)" % (name, " ".join(self.holecards[name]['PREFLOP']))) + # TODO: legacy importer can't handle only one holecard here, make sure there are 2 for holdem, 4 for omaha + # TOOD: If HoldHand subclass supports more than omahahi, omahahilo, holdem, add them here + numOfHoleCardsNeeded = None + if self.gametype['category'] in ('omahahi','omahahilo'): + numOfHoleCardsNeeded = 4 + elif self.gametype['category'] in ('holdem'): + numOfHoleCardsNeeded = 2 + if len(self.holecards[name]['PREFLOP']) == numOfHoleCardsNeeded: + print >>fh, _("%s shows [%s] (a hand...)" % (name, " ".join(self.holecards[name]['PREFLOP']))) # Current PS format has the lines: # Uncalled bet ($111.25) returned to s0rrow