From d605f895648863efcb6022a048591630d186a6a1 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 8 Sep 2010 01:08:23 +0800 Subject: [PATCH 01/10] OnGame: Make sure time can't fail and report erro --- pyfpdb/OnGameToFpdb.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyfpdb/OnGameToFpdb.py b/pyfpdb/OnGameToFpdb.py index ecdc6cda..e1db196e 100755 --- a/pyfpdb/OnGameToFpdb.py +++ b/pyfpdb/OnGameToFpdb.py @@ -216,11 +216,14 @@ class OnGame(HandHistoryConverter): #hand.startTime = time.strptime(m.group('DATETIME'), "%a %b %d %H:%M:%S GMT%z %Y") # Stupid library doesn't seem to support %z (http://docs.python.org/library/time.html?highlight=strptime#time.strptime) # So we need to re-interpret te string to be useful - m1 = self.re_DateTime.finditer(info[key]) - for a in m1: + a = self.re_DateTime.search(info[key]) + if a: datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'),a.group('M'), a.group('D'), a.group('H'),a.group('MIN'),a.group('S')) tzoffset = a.group('OFFSET') - # TODO: Manually adjust time against OFFSET + else: + datetimestr = "2010/01/01 01:01:01" + log.error(_("readHandInfo: DATETIME not matched: '%s'" % info[key])) + # TODO: Manually adjust time against OFFSET hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%b/%d %H:%M:%S") # also timezone at end, e.g. " ET" hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, tzoffset, "UTC") if key == 'HID': From 3759751fe4bd5fe143c86fb44d9f30ebf2acd484 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 8 Sep 2010 15:11:55 +0800 Subject: [PATCH 02/10] HHC: Raise exception when game isn't supported. --- pyfpdb/HandHistoryConverter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 6506afca..8eb2b9b6 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -289,6 +289,7 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py. base = gametype['base'] limit = gametype['limitType'] l = [type] + [base] + [limit] + if l in self.readSupportedGames(): if gametype['base'] == 'hold': log.debug("hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handtext)") @@ -299,14 +300,14 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py. hand = Hand.DrawHand(self.config, self, self.sitename, gametype, handText) else: log.info(_("Unsupported game type: %s" % gametype)) + raise FpdbParseError(_("Unsupported game type: %s" % gametype)) if hand: #hand.writeHand(self.out_fh) return hand else: - log.info(_("Unsupported game type: %s" % gametype)) + log.error(_("Unsupported game type: %s" % gametype)) # TODO: pity we don't know the HID at this stage. Log the entire hand? - # From the log we can deduce that it is the hand after the one before :) # These functions are parse actions that may be overridden by the inheriting class From 74a0c3d7dad62be285f193986cd841abe9dace99 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 8 Sep 2010 15:43:20 +0800 Subject: [PATCH 03/10] HHReplayer: Add file for Hud testing Uses pygame, was playing around with the idea of using this library to create a replayer with sprite animations. --- pyfpdb/HHReplayer.py | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 pyfpdb/HHReplayer.py diff --git a/pyfpdb/HHReplayer.py b/pyfpdb/HHReplayer.py new file mode 100644 index 00000000..4eba02b4 --- /dev/null +++ b/pyfpdb/HHReplayer.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +import os, pygame +import time +from pygame.locals import * +from pygame.compat import geterror + +main_dir = os.path.split(os.path.abspath(__file__))[0] +data_dir = os.path.join(main_dir, '.') + +def load_image(name, colorkey=None): + fullname = os.path.join(data_dir, name) + try: + image = pygame.image.load(fullname) + except pygame.error: + print ('Cannot load image:', fullname) + print "data_dir: '%s' name: '%s'" %( data_dir, name) + raise SystemExit(str(geterror())) + image = image.convert() + if colorkey is not None: + if colorkey is -1: + colorkey = image.get_at((0,0)) + image.set_colorkey(colorkey, RLEACCEL) + return image, image.get_rect() + + +def main(): + #Initialize Everything + pygame.init() + clock = pygame.time.Clock() + screen = pygame.display.set_mode((640, 480)) + table_string = "Tournament 2010090009 Table %s - Blinds $600/$1200 Anto $150" + table_no = 1 + table_title = "Nongoma V - $200/$400 USD - Limit Holdem" + pygame.display.set_caption(table_title) + pygame.mouse.set_visible(0) + + # Load background image + bgimage, rect = load_image('../gfx/Table.png') + background = pygame.Surface(screen.get_size()) + background.blit(bgimage, (0, 0)) + + #Put Text On The Background, Centered + if pygame.font: + font = pygame.font.Font(None, 24) + text = font.render("FPDB Replayer Table", 1, (10, 10, 10)) + textpos = text.get_rect(centerx=background.get_width()/2) + background.blit(text, textpos) + + #Display The Background + screen.blit(background, (0, 0)) + pygame.display.flip() + + going = True + while going: + clock.tick(6000) + # Draw + screen.blit(background, (0, 0)) + # Change table # + #table_no += 1 + #table_title = "Tournament 2010090009 Table %s - Blinds $600/$1200 Anto $150" % table_no + #pygame.display.set_caption(table_title) + time.sleep(10) + + +if __name__ == '__main__': + main() + From 0dbde2d9b71c17f2a5ade85f8e1ae14034a42491 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 8 Sep 2010 15:45:10 +0800 Subject: [PATCH 04/10] Table.png: Worst.poker.table.image.ever --- gfx/Table.png | Bin 0 -> 9546 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 gfx/Table.png diff --git a/gfx/Table.png b/gfx/Table.png new file mode 100644 index 0000000000000000000000000000000000000000..60053098b1e942915fa87444dc3686122fb36ea2 GIT binary patch literal 9546 zcmch7cQ}>*|NrY8$KDZAMrB4(_Ff@dA|n|^BrCHNP6w&vo4w=f2NtKgZ+wc-)T+^)+d!*r^agv|8uR8X<(mBZL{D zz`~u%Vx406gYh)dR7H6$N2cHlrTaN^PlTwMh!+OMC$hm!axX1Cb@Dz+EafTEcO9Eb zaO;qlx|x@nn~RIRs~1x9u($QHx8wG`?&Zj>sikLVdXJ73A#S8~R>k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CH 05/10] OnGame: Debugging Betfair skin date format with user --- pyfpdb/OnGameToFpdb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyfpdb/OnGameToFpdb.py b/pyfpdb/OnGameToFpdb.py index e1db196e..a687a9da 100755 --- a/pyfpdb/OnGameToFpdb.py +++ b/pyfpdb/OnGameToFpdb.py @@ -221,8 +221,9 @@ class OnGame(HandHistoryConverter): datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'),a.group('M'), a.group('D'), a.group('H'),a.group('MIN'),a.group('S')) tzoffset = a.group('OFFSET') else: - datetimestr = "2010/01/01 01:01:01" + datetimestr = "2010/Jan/01 01:01:01" log.error(_("readHandInfo: DATETIME not matched: '%s'" % info[key])) + print "DEBUG: readHandInfo: DATETIME not matched: '%s'" % info[key] # TODO: Manually adjust time against OFFSET hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%b/%d %H:%M:%S") # also timezone at end, e.g. " ET" hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, tzoffset, "UTC") From 3b55bd19dbaa77248e96fd0a6ccd96dc72d2204e Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 8 Sep 2010 16:05:04 +0800 Subject: [PATCH 06/10] OnGame: Fix date regex Previously assumed that the day was 2 characters, and failed on: 'Fri Sep 3 05:01:22 GMT+0100 2010' Doh --- pyfpdb/OnGameToFpdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/OnGameToFpdb.py b/pyfpdb/OnGameToFpdb.py index a687a9da..ae5549cc 100755 --- a/pyfpdb/OnGameToFpdb.py +++ b/pyfpdb/OnGameToFpdb.py @@ -111,7 +111,7 @@ class OnGame(HandHistoryConverter): re_DateTime = re.compile(""" [a-zA-Z]{3}\s (?P[a-zA-Z]{3})\s - (?P[0-9]{2})\s + (?P[0-9]+)\s (?P[0-9]+):(?P[0-9]+):(?P[0-9]+)\s (?P\w+[-+]\d+)\s (?P[0-9]{4}) From bdb0bda3a0dd1ce4f4f01cad65f25600106c7946 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 9 Sep 2010 10:31:40 +0800 Subject: [PATCH 07/10] OnGame: remove non-digits from hand id Fixing email reported error with MySQL: fpdb starting ...Traceback (most recent call last): File "GuiBulkImport.pyc", line 107, in load_clicked File "fpdb_import.pyc", line 251, in runImport File "fpdb_import.pyc", line 314, in importFiles File "fpdb_import.pyc", line 482, in import_file_dict File "Hand.pyc", line 273, in insert File "Database.pyc", line 1651, in storeHand File "MySQLdb\cursors.pyc", line 174, in execute File "MySQLdb\connections.pyc", line 36, in defaulterrorhandler _mysql_exceptions.OperationalError: (1366, "Incorrect integer value: 'R5-79731715-280' for column 'siteHandNo' at row 1") --- pyfpdb/OnGameToFpdb.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyfpdb/OnGameToFpdb.py b/pyfpdb/OnGameToFpdb.py index ae5549cc..94d9afbc 100755 --- a/pyfpdb/OnGameToFpdb.py +++ b/pyfpdb/OnGameToFpdb.py @@ -229,6 +229,9 @@ class OnGame(HandHistoryConverter): hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, tzoffset, "UTC") if key == 'HID': hand.handid = info[key] + # Need to remove non-alphanumerics for MySQL + hand.handid = hand.handid.replace('R','') + hand.handid = hand.handid.replace('-','') if key == 'TABLE': hand.tablename = info[key] From 34f0c93351bff4b6421721b55254f3b0d10a7b7e Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 9 Sep 2010 13:14:19 +0800 Subject: [PATCH 08/10] Regression: Add Stars Stud crasher. This hand contains only 6 of the 7 cards for 'shown' and 'mucked' --- ...0.04-0.08-200907.Missing.Showdown.Card.txt | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 pyfpdb/regression-test-files/cash/Stars/Stud/7-Stud-USD-0.04-0.08-200907.Missing.Showdown.Card.txt diff --git a/pyfpdb/regression-test-files/cash/Stars/Stud/7-Stud-USD-0.04-0.08-200907.Missing.Showdown.Card.txt b/pyfpdb/regression-test-files/cash/Stars/Stud/7-Stud-USD-0.04-0.08-200907.Missing.Showdown.Card.txt new file mode 100644 index 00000000..d384d772 --- /dev/null +++ b/pyfpdb/regression-test-files/cash/Stars/Stud/7-Stud-USD-0.04-0.08-200907.Missing.Showdown.Card.txt @@ -0,0 +1,117 @@ +PokerStars Game #30506593746: 7 Card Stud Limit ($0.04/$0.08) - 2009/07/16 2:36:31 CET [2009/07/15 20:36:31 ET] +Table 'Laomedon' 8-max +Seat 1: Player1 ($1.81 in chips) +Seat 2: Player2 ($2.46 in chips) +Seat 3: Player3 ($1.67 in chips) +Seat 4: Player4 ($0.35 in chips) +Seat 5: Player5 ($1.75 in chips) +Seat 6: Player6 ($2.92 in chips) +Seat 7: Player7 ($1.54 in chips) +Seat 8: Player8 ($0.71 in chips) +Player1: posts the ante $0.01 +Player2: posts the ante $0.01 +Player3: posts the ante $0.01 +Player4: posts the ante $0.01 +Player5: posts the ante $0.01 +Player6: posts the ante $0.01 +Player7: posts the ante $0.01 +Player8: posts the ante $0.01 +*** 3rd STREET *** +Dealt to Player1 [Ac Kc 8c] +Dealt to Player2 [Tc] +Dealt to Player3 [6c] +Dealt to Player4 [Js] +Dealt to Player5 [Jd] +Dealt to Player6 [2d] +Dealt to Player7 [Jh] +Dealt to Player8 [Kh] +Player6: brings in for $0.02 +Player7: calls $0.02 +Player8: calls $0.02 +Player1: calls $0.02 +Player2: calls $0.02 +Player3: calls $0.02 +Player4: calls $0.02 +Player5: calls $0.02 +*** 4th STREET *** +Dealt to Player1 [Ac Kc 8c] [9c] +Dealt to Player2 [Tc] [7d] +Dealt to Player3 [6c] [7h] +Dealt to Player4 [Js] [2c] +Dealt to Player5 [Jd] [4h] +Dealt to Player6 [2d] [7c] +Dealt to Player7 [Jh] [4c] +Dealt to Player8 [Kh] [3d] +Player8: checks +Player1: checks +Player2: checks +Player3: checks +Player4: checks +Player5: checks +Player6: checks +Player7: checks +*** 5th STREET *** +Dealt to Player1 [Ac Kc 8c 9c] [9d] +Dealt to Player2 [Tc 7d] [8d] +Dealt to Player3 [6c 7h] [3s] +Dealt to Player4 [Js 2c] [9s] +Dealt to Player5 [Jd 4h] [9h] +Dealt to Player6 [2d 7c] [6d] +Dealt to Player7 [Jh 4c] [5d] +Dealt to Player8 [Kh 3d] [8s] +Player1: checks +Player2: checks +Player3: checks +Player4: checks +Player5: checks +Player6: checks +Player7: checks +Player8: checks +*** 6th STREET *** +Dealt to Player1 [Ac Kc 8c 9c 9d] [Th] +Dealt to Player2 [Tc 7d 8d] [3c] +Dealt to Player3 [6c 7h 3s] [Qh] +Dealt to Player4 [Js 2c 9s] [8h] +Dealt to Player5 [Jd 4h 9h] [2s] +Dealt to Player6 [2d 7c 6d] [5h] +Dealt to Player7 [Jh 4c 5d] [Td] +Dealt to Player8 [Kh 3d 8s] [6s] +Player1: checks +Player2: checks +Player3: checks +Player4: checks +Player5: checks +Player6: checks +Player7: checks +Player8: checks +*** RIVER *** [6h] +Player1: checks +Player2: checks +Player3: bets $0.08 +Player4: folds +Player5: calls $0.08 +Player6: calls $0.08 +Player7: folds +Player8: calls $0.08 +Player1: folds +Player2: folds +*** SHOW DOWN *** +Player3: shows [7s Qs 6c 7h 3s Qh] (two pair, Queens and Sevens) +Player5: mucks hand +Player6: mucks hand +Player8: mucks hand +Player3 collected $0.54 from pot +*** SUMMARY *** +Total pot $0.56 | Rake $0.02 +Board [6h] +Seat 1: Player1 folded on the River +Seat 2: Player2 folded on the River +Seat 3: Player3 showed [7s Qs 6c 7h 3s Qh] and won ($0.54) with two pair, Queens and Sevens +Seat 4: Player4 folded on the River +Seat 5: Player5 mucked [Kd Ks Jd 4h 9h 2s] +Seat 6: Player6 mucked [5s Ah 2d 7c 6d 5h] +Seat 7: Player7 folded on the River +Seat 8: Player8 mucked [Jc 3h Kh 3d 8s 6s] + + + From e1bb9a602bdd8a9825e0dc9ef5ec832f5bb12121 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 9 Sep 2010 13:19:19 +0800 Subject: [PATCH 09/10] Stars/Hand: Fix issue produced by last regression test file 7-Stud-USD-0.04-0.08-200907.Missing.Showdown.Card.txt only contains 6 showdown cards. Put filthy hack in addShownCards to guard against this condition, and add a commented out debug print in the HHC --- pyfpdb/Hand.py | 3 ++- pyfpdb/PokerStarsToFpdb.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 9f9d009d..c1dec3ff 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -1224,7 +1224,8 @@ class StudHand(Hand): self.addHoleCards('FOURTH', player, open=[cards[3]], closed=[cards[2]], shown=shown, mucked=mucked) self.addHoleCards('FIFTH', player, open=[cards[4]], closed=cards[2:4], shown=shown, mucked=mucked) self.addHoleCards('SIXTH', player, open=[cards[5]], closed=cards[2:5], shown=shown, mucked=mucked) - self.addHoleCards('SEVENTH', player, open=[], closed=[cards[6]], shown=shown, mucked=mucked) + if len(cards) > 6: + self.addHoleCards('SEVENTH', player, open=[], closed=[cards[6]], shown=shown, mucked=mucked) def addPlayerCards(self, player, street, open=[], closed=[]): diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index bac45faf..baa7718b 100644 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -454,6 +454,7 @@ class PokerStars(HandHistoryConverter): if m.group('SHOWED') == "showed": shown = True elif m.group('SHOWED') == "mucked": mucked = True + #print "DEBUG: hand.addShownCards(%s, %s, %s, %s)" %(cards, m.group('PNAME'), shown, mucked) hand.addShownCards(cards=cards, player=m.group('PNAME'), shown=shown, mucked=mucked) if __name__ == "__main__": From bc4a53d754c998ca03ed47c36b5e2708410c6f83 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 9 Sep 2010 15:14:54 +0800 Subject: [PATCH 10/10] FTP: Fix re_PlayerInfo to find ', is sitting out' for cash games Turns out that a player sitting out at the start of a cash game hand can (in what i hope is a small set of hands) be dealt cards and act in a hand --- pyfpdb/FulltiltToFpdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index f94903c5..2c823dd1 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -84,7 +84,7 @@ class Fulltilt(HandHistoryConverter): (\s\((?PTurbo)\))?)|(?P.+)) ''' % substitutions, re.VERBOSE) re_Button = re.compile('^The button is in seat #(?P