From 90e991dec850dbd4d792f21fc4c17b1f8b54fa7e Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 14 Sep 2010 18:58:05 +0800 Subject: [PATCH 1/7] Regression: Omaha limit OnGame hh --- .../Flop/LO-9max-0.05-0.10-201009.Sample.txt | 444 ++++++++++++++++++ 1 file changed, 444 insertions(+) create mode 100644 pyfpdb/regression-test-files/cash/OnGame/Flop/LO-9max-0.05-0.10-201009.Sample.txt diff --git a/pyfpdb/regression-test-files/cash/OnGame/Flop/LO-9max-0.05-0.10-201009.Sample.txt b/pyfpdb/regression-test-files/cash/OnGame/Flop/LO-9max-0.05-0.10-201009.Sample.txt new file mode 100644 index 00000000..96661590 --- /dev/null +++ b/pyfpdb/regression-test-files/cash/OnGame/Flop/LO-9max-0.05-0.10-201009.Sample.txt @@ -0,0 +1,444 @@ +***** History for hand R5-81867677-656 ***** +Start hand: Mon Sep 13 00:26:26 GMT+0100 2010 +Table: Tilburg [81867677] (LIMIT OMAHA_HI $0.05/$0.10, Real money) +User: tchazx +Button: seat 8 +Players in round: 3 +Seat 3: nickgerm ($3.74) +Seat 4: tchazx ($5) +Seat 8: XYXY26XYXY ($1.79) +nickgerm posts small blind ($0.02) +tchazx posts big blind ($0.05) +--- +Dealing pocket cards +Dealing to tchazx: [Ks, 4s, 6s, Th] +XYXY26XYXY calls $0.05 +nickgerm calls $0.03 +tchazx checks +--- Dealing flop [5h, 7d, 2s] +nickgerm checks +tchazx checks +XYXY26XYXY checks +--- Dealing turn [Qs] +nickgerm checks +tchazx checks +XYXY26XYXY checks +--- Dealing river [4d] +nickgerm bets $0.10 +tchazx folds +XYXY26XYXY folds +--- +Summary: +Main pot: $0.15 won by nickgerm ($0.15) +Rake taken: $0 +Seat 3: nickgerm ($3.84), net: +$0.10 +Seat 4: tchazx ($4.95), net: -$0.05 +Seat 8: XYXY26XYXY ($1.74), net: -$0.05 +***** End of hand R5-81867677-656 ***** +***** History for hand R5-81867677-657 ***** +Start hand: Mon Sep 13 00:27:13 GMT+0100 2010 +Table: Tilburg [81867677] (LIMIT OMAHA_HI $0.05/$0.10, Real money) +User: tchazx +Button: seat 3 +Players in round: 3 +Seat 4: tchazx ($4.95) +Seat 8: XYXY26XYXY ($1.74) +Seat 3: nickgerm ($3.84) +tchazx posts small blind ($0.02) +XYXY26XYXY posts big blind ($0.05) +--- +Dealing pocket cards +Dealing to tchazx: [Jd, Td, 8h, Tc] +nickgerm calls $0.05 +tchazx calls $0.03 +XYXY26XYXY checks +--- Dealing flop [4h, 7c, 2c] +tchazx checks +XYXY26XYXY checks +nickgerm checks +--- Dealing turn [Kc] +tchazx checks +XYXY26XYXY checks +nickgerm bets $0.10 +tchazx folds +XYXY26XYXY calls $0.10 +--- Dealing river [3d] +XYXY26XYXY checks +nickgerm bets $0.10 +XYXY26XYXY calls $0.10 +--- +Summary: +Main pot: $0.55 won by nickgerm ($0.27), XYXY26XYXY ($0.26) +Rake taken: $0.02 +Seat 4: tchazx ($4.90), net: -$0.05 +Seat 8: XYXY26XYXY ($1.75), net: +$0.01, [7h, Qs, 9c, Kd] (TWO_PAIR KING, SEVEN) +Seat 3: nickgerm ($3.86), net: +$0.02, [7d, 6s, Ks, Jc] (TWO_PAIR KING, SEVEN) +***** End of hand R5-81867677-657 ***** +***** History for hand R5-81867677-658 ***** +Start hand: Mon Sep 13 00:28:06 GMT+0100 2010 +Table: Tilburg [81867677] (LIMIT OMAHA_HI $0.05/$0.10, Real money) +User: tchazx +Button: seat 4 +Players in round: 5 +Seat 8: XYXY26XYXY ($1.75) +Seat 10: Mandala14 ($3) +Seat 1: ANOKATO ($2.33) +Seat 3: nickgerm ($3.86) +Seat 4: tchazx ($4.90) +XYXY26XYXY posts small blind ($0.02) +Mandala14 posts big blind ($0.05) +ANOKATO posts big blind ($0.05) +--- +Dealing pocket cards +Dealing to tchazx: [Ad, Js, Jc, 9h] +ANOKATO checks +nickgerm raises $0.10 to $0.10 +tchazx calls $0.10 +XYXY26XYXY calls $0.08 +Mandala14 calls $0.05 +ANOKATO calls $0.05 +--- Dealing flop [6h, 2s, 5c] +XYXY26XYXY checks +Mandala14 checks +ANOKATO bets $0.05 +nickgerm raises $0.10 to $0.10 +tchazx calls $0.10 +XYXY26XYXY folds +Mandala14 calls $0.10 +ANOKATO raises $0.10 to $0.15 +nickgerm calls $0.05 +tchazx calls $0.05 +Mandala14 calls $0.05 +--- Dealing turn [Kh] +Mandala14 checks +ANOKATO bets $0.10 +nickgerm calls $0.10 +tchazx calls $0.10 +Mandala14 calls $0.10 +--- Dealing river [Ks] +Mandala14 bets $0.10 +ANOKATO calls $0.10 +nickgerm folds +tchazx calls $0.10 +--- +Summary: +Main pot: $1.80 won by Mandala14 ($1.71) +Rake taken: $0.09 +Seat 8: XYXY26XYXY ($1.65), net: -$0.10 +Seat 10: Mandala14 ($4.26), net: +$1.26, [As, Ah, 5s, Qs] (TWO_PAIR ACE, KING) +Seat 1: ANOKATO ($1.88), net: -$0.45 +Seat 3: nickgerm ($3.51), net: -$0.35 +Seat 4: tchazx ($4.45), net: -$0.45 +***** End of hand R5-81867677-658 ***** +***** History for hand R5-81867677-659 ***** +Start hand: Mon Sep 13 00:29:21 GMT+0100 2010 +Table: Tilburg [81867677] (LIMIT OMAHA_HI $0.05/$0.10, Real money) +User: tchazx +Button: seat 8 +Players in round: 5 +Seat 10: Mandala14 ($4.26) +Seat 1: ANOKATO ($1.88) +Seat 3: nickgerm ($3.51) +Seat 4: tchazx ($4.45) +Seat 8: XYXY26XYXY ($1.65) +Mandala14 posts small blind ($0.02) +ANOKATO posts big blind ($0.05) +--- +Dealing pocket cards +Dealing to tchazx: [5h, Tc, 9c, 3h] +nickgerm raises $0.10 to $0.10 +tchazx calls $0.10 +XYXY26XYXY calls $0.10 +Mandala14 calls $0.08 +ANOKATO calls $0.05 +--- Dealing flop [8s, 4d, 6d] +Mandala14 checks +ANOKATO checks +nickgerm bets $0.05 +tchazx calls $0.05 +XYXY26XYXY calls $0.05 +Mandala14 calls $0.05 +ANOKATO calls $0.05 +--- Dealing turn [9s] +Mandala14 checks +ANOKATO bets $0.10 +nickgerm raises $0.20 to $0.20 +tchazx folds +XYXY26XYXY calls $0.20 +Mandala14 calls $0.20 +ANOKATO raises $0.20 to $0.30 +nickgerm calls $0.10 +XYXY26XYXY calls $0.10 +Mandala14 calls $0.10 +--- Dealing river [4c] +Mandala14 checks +ANOKATO bets $0.10 +nickgerm folds +XYXY26XYXY folds +Mandala14 folds +--- +Summary: +Main pot: $1.95 won by ANOKATO ($1.86) +Rake taken: $0.09 +Seat 10: Mandala14 ($3.81), net: -$0.45 +Seat 1: ANOKATO ($3.29), net: +$1.41 +Seat 3: nickgerm ($3.06), net: -$0.45 +Seat 4: tchazx ($4.30), net: -$0.15 +Seat 8: XYXY26XYXY ($1.20), net: -$0.45 +***** End of hand R5-81867677-659 ***** +***** History for hand R5-81867677-660 ***** +Start hand: Mon Sep 13 00:30:43 GMT+0100 2010 +Table: Tilburg [81867677] (LIMIT OMAHA_HI $0.05/$0.10, Real money) +User: tchazx +Button: seat 10 +Players in round: 5 +Seat 1: ANOKATO ($3.29) +Seat 3: nickgerm ($3.06) +Seat 4: tchazx ($4.30) +Seat 8: XYXY26XYXY ($1.20) +Seat 10: Mandala14 ($3.81) +ANOKATO posts small blind ($0.02) +nickgerm posts big blind ($0.05) +--- +Dealing pocket cards +Dealing to tchazx: [Qh, 4d, Ts, 9d] +tchazx calls $0.05 +XYXY26XYXY calls $0.05 +Mandala14 calls $0.05 +ANOKATO calls $0.03 +nickgerm raises $0.05 to $0.10 +tchazx calls $0.05 +XYXY26XYXY calls $0.05 +Mandala14 calls $0.05 +ANOKATO calls $0.05 +--- Dealing flop [6d, 3c, Qc] +ANOKATO checks +nickgerm bets $0.05 +tchazx calls $0.05 +XYXY26XYXY calls $0.05 +Mandala14 calls $0.05 +ANOKATO calls $0.05 +--- Dealing turn [7h] +ANOKATO checks +nickgerm checks +tchazx checks +XYXY26XYXY checks +Mandala14 checks +--- Dealing river [Jh] +ANOKATO bets $0.10 +nickgerm folds +tchazx calls $0.10 +XYXY26XYXY folds +Mandala14 folds +--- +Summary: +Main pot: $0.95 won by ANOKATO ($0.91) +Rake taken: $0.04 +Seat 1: ANOKATO ($3.95), net: +$0.66, [7c, Qd, Ks, 5d] (TWO_PAIR QUEEN, SEVEN) +Seat 3: nickgerm ($2.91), net: -$0.15 +Seat 4: tchazx ($4.05), net: -$0.25 +Seat 8: XYXY26XYXY ($1.05), net: -$0.15 +Seat 10: Mandala14 ($3.66), net: -$0.15 +***** End of hand R5-81867677-660 ***** +***** History for hand R5-81867677-661 ***** +Start hand: Mon Sep 13 00:31:54 GMT+0100 2010 +Table: Tilburg [81867677] (LIMIT OMAHA_HI $0.05/$0.10, Real money) +User: tchazx +Button: seat 1 +Players in round: 5 +Seat 3: nickgerm ($2.91) +Seat 4: tchazx ($4.05) +Seat 8: XYXY26XYXY ($1.05) +Seat 10: Mandala14 ($3.66) +Seat 1: ANOKATO ($3.95) +nickgerm posts small blind ($0.02) +tchazx posts big blind ($0.05) +--- +Dealing pocket cards +Dealing to tchazx: [5d, 9h, 6h, 4h] +XYXY26XYXY calls $0.05 +Mandala14 calls $0.05 +ANOKATO calls $0.05 +nickgerm calls $0.03 +tchazx checks +--- Dealing flop [2d, 4d, Jh] +nickgerm bets $0.05 +tchazx folds +XYXY26XYXY calls $0.05 +Mandala14 folds +ANOKATO calls $0.05 +--- Dealing turn [As] +nickgerm bets $0.10 +XYXY26XYXY calls $0.10 +ANOKATO raises $0.20 to $0.20 +nickgerm calls $0.10 +XYXY26XYXY calls $0.10 +--- Dealing river [Jc] +nickgerm bets $0.10 +XYXY26XYXY calls $0.10 +ANOKATO raises $0.20 to $0.20 +nickgerm raises $0.20 to $0.30 +XYXY26XYXY folds +ANOKATO calls $0.10 +--- +Summary: +Main pot: $1.70 won by nickgerm ($1.62) +Rake taken: $0.08 +Seat 3: nickgerm ($3.93), net: +$1.02, [9c, 4s, Jd, 6c] (FULL_HOUSE JACK, FOUR) +Seat 4: tchazx ($4), net: -$0.05 +Seat 8: XYXY26XYXY ($0.65), net: -$0.40 +Seat 10: Mandala14 ($3.61), net: -$0.05 +Seat 1: ANOKATO ($3.35), net: -$0.60 +***** End of hand R5-81867677-661 ***** +***** History for hand R5-81867677-662 ***** +Start hand: Mon Sep 13 00:33:20 GMT+0100 2010 +Table: Tilburg [81867677] (LIMIT OMAHA_HI $0.05/$0.10, Real money) +User: tchazx +Button: seat 3 +Players in round: 5 +Seat 4: tchazx ($4) +Seat 8: XYXY26XYXY ($0.65) +Seat 10: Mandala14 ($3.61) +Seat 1: ANOKATO ($3.35) +Seat 3: nickgerm ($3.93) +tchazx posts small blind ($0.02) +XYXY26XYXY posts big blind ($0.05) +--- +Dealing pocket cards +Dealing to tchazx: [5s, 6c, Kc, 3s] +Mandala14 calls $0.05 +ANOKATO calls $0.05 +nickgerm raises $0.10 to $0.10 +tchazx folds +XYXY26XYXY calls $0.05 +Mandala14 calls $0.05 +ANOKATO calls $0.05 +--- Dealing flop [3h, 2d, 2s] +XYXY26XYXY checks +Mandala14 checks +ANOKATO checks +nickgerm bets $0.05 +XYXY26XYXY calls $0.05 +Mandala14 folds +ANOKATO raises $0.10 to $0.10 +nickgerm calls $0.05 +XYXY26XYXY folds +--- Dealing turn [4d] +ANOKATO checks +nickgerm bets $0.10 +ANOKATO raises $0.20 to $0.20 +nickgerm calls $0.10 +--- Dealing river [Ts] +ANOKATO checks +nickgerm checks +--- +Summary: +Main pot: $1.07 won by ANOKATO ($1.02) +Rake taken: $0.05 +Seat 4: tchazx ($3.98), net: -$0.02 +Seat 8: XYXY26XYXY ($0.50), net: -$0.15 +Seat 10: Mandala14 ($3.51), net: -$0.10 +Seat 1: ANOKATO ($3.97), net: +$0.62, [Js, 5c, 9c, 2h] (THREE_OF_A_KIND TWO) +Seat 3: nickgerm ($3.53), net: -$0.40 +***** End of hand R5-81867677-662 ***** +***** History for hand R5-81867677-663 ***** +Start hand: Mon Sep 13 00:34:34 GMT+0100 2010 +Table: Tilburg [81867677] (LIMIT OMAHA_HI $0.05/$0.10, Real money) +User: tchazx +Button: seat 4 +Players in round: 5 +Seat 8: XYXY26XYXY ($0.50) +Seat 10: Mandala14 ($3.51) +Seat 1: ANOKATO ($3.97) +Seat 3: nickgerm ($3.53) +Seat 4: tchazx ($3.98) +XYXY26XYXY posts small blind ($0.02) +Mandala14 posts big blind ($0.05) +--- +Dealing pocket cards +Dealing to tchazx: [Ac, 9h, 6h, Jc] +ANOKATO calls $0.05 +nickgerm calls $0.05 +tchazx calls $0.05 +XYXY26XYXY calls $0.03 +Mandala14 checks +--- Dealing flop [7s, 4c, 8s] +XYXY26XYXY checks +Mandala14 checks +ANOKATO bets $0.05 +nickgerm calls $0.05 +tchazx calls $0.05 +XYXY26XYXY calls $0.05 +Mandala14 calls $0.05 +--- Dealing turn [2d] +XYXY26XYXY checks +Mandala14 checks +ANOKATO bets $0.10 +nickgerm raises $0.20 to $0.20 +tchazx calls $0.20 +XYXY26XYXY calls $0.20 +Mandala14 calls $0.20 +ANOKATO calls $0.10 +--- Dealing river [4h] +XYXY26XYXY bets $0.10 +Mandala14 folds +ANOKATO calls $0.10 +nickgerm raises $0.20 to $0.20 +tchazx folds +XYXY26XYXY calls $0.10 [all in] +ANOKATO folds +--- +Summary: +Main pot: $2 won by XYXY26XYXY ($1.90) +Rake taken: $0.10 +Seat 8: XYXY26XYXY ($1.90), net: +$1.40, [8d, 5c, 4d, 3c] (FULL_HOUSE FOUR, EIGHT) +Seat 10: Mandala14 ($3.21), net: -$0.30 +Seat 1: ANOKATO ($3.57), net: -$0.40 +Seat 3: nickgerm ($3.03), net: -$0.50, [6s, Th, 3d, 5d] (STRAIGHT EIGHT) +Seat 4: tchazx ($3.68), net: -$0.30 +***** End of hand R5-81867677-663 ***** +***** History for hand R5-81867677-664 ***** +Start hand: Mon Sep 13 00:36:21 GMT+0100 2010 +Table: Tilburg [81867677] (LIMIT OMAHA_HI $0.05/$0.10, Real money) +User: tchazx +Button: seat 8 +Players in round: 5 +Seat 10: Mandala14 ($3.21) +Seat 1: ANOKATO ($3.57) +Seat 3: nickgerm ($3.03) +Seat 4: tchazx ($3.68) +Seat 8: XYXY26XYXY ($1.90) +Mandala14 posts small blind ($0.02) +ANOKATO posts big blind ($0.05) +--- +Dealing pocket cards +Dealing to tchazx: [7d, Kh, 4s, Jh] +nickgerm calls $0.05 +tchazx calls $0.05 +XYXY26XYXY folds +Mandala14 calls $0.03 +ANOKATO checks +--- Dealing flop [4h, Js, Ac] +Mandala14 checks +ANOKATO folds +nickgerm bets $0.05 +tchazx calls $0.05 +Mandala14 calls $0.05 +--- Dealing turn [8c] +Mandala14 checks +nickgerm checks +tchazx checks +--- Dealing river [3d] +Mandala14 checks +nickgerm checks +tchazx checks +--- +Summary: +Main pot: $0.35 won by tchazx ($0.34) +Rake taken: $0.01 +Seat 10: Mandala14 ($3.11), net: -$0.10, [7h, 4d, Qh, 6d] (PAIR FOUR) +Seat 1: ANOKATO ($3.52), net: -$0.05 +Seat 3: nickgerm ($2.93), net: -$0.10, [7s, Qd, 6s, Ah] (PAIR ACE) +Seat 4: tchazx ($3.92), net: +$0.24, [7d, Kh, 4s, Jh] (TWO_PAIR JACK, FOUR) +Seat 8: XYXY26XYXY ($1.90) +***** End of hand R5-81867677-664 ***** From a7d450d38462e3775dfb6aabdbe2be679604e466 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 15 Sep 2010 13:23:32 +0800 Subject: [PATCH 2/7] Importer: Add command line option for FTP archive format. To import ./GuiBulkImport -F -c "Full Tilt Poker" -f filename Completely untested at the moment. --- pyfpdb/GuiBulkImport.py | 4 ++++ pyfpdb/fpdb_import.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py index 5b9e0c53..cd374545 100755 --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -358,6 +358,8 @@ def main(argv=None): help=_("Print some useful one liners")) parser.add_option("-s", "--starsarchive", action="store_true", dest="starsArchive", default=False, help=_("Do the required conversion for Stars Archive format (ie. as provided by support")) + parser.add_option("-F", "--ftparchive", action="store_true", dest="ftpArchive", default=False, + help=_("Do the required conversion for FTP Archive format (ie. as provided by support")) parser.add_option("-t", "--testdata", action="store_true", dest="testData", default=False, help=_("Output the pprinted version of the HandsPlayer hash for regresion testing")) (options, argv) = parser.parse_args(args = argv) @@ -404,6 +406,8 @@ def main(argv=None): importer.setCallHud(False) if options.starsArchive: importer.setStarsArchive(True) + if options.ftpArchive: + importer.setFTPArchive(True) if options.testData: importer.setPrintTestData(True) (stored, dups, partial, errs, ttime) = importer.runImport() diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 1b770ce5..102da6fc 100755 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -103,6 +103,7 @@ class Importer: self.settings.setdefault("dropIndexes", "don't drop") self.settings.setdefault("dropHudCache", "don't drop") self.settings.setdefault("starsArchive", False) + self.settings.setdefault("ftpArchive", False) self.settings.setdefault("testData", False) self.settings.setdefault("cacheHHC", False) @@ -149,6 +150,9 @@ class Importer: def setStarsArchive(self, value): self.settings['starsArchive'] = value + def setFTPArchive(self, value): + self.settings['ftpArchive'] = value + def setPrintTestData(self, value): self.settings['testData'] = value From aae1ad082e3e9d9770ef95914d10ab9c895fa6b7 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 15 Sep 2010 13:25:44 +0800 Subject: [PATCH 3/7] OnGame: add dead blind detection --- pyfpdb/OnGameToFpdb.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyfpdb/OnGameToFpdb.py b/pyfpdb/OnGameToFpdb.py index 22f283d2..62eb2d96 100755 --- a/pyfpdb/OnGameToFpdb.py +++ b/pyfpdb/OnGameToFpdb.py @@ -139,7 +139,8 @@ class OnGame(HandHistoryConverter): self.re_PostBB = re.compile('(?P.*) posts big blind \((%(CUR)s)?(?P[\.0-9]+)\)' % subst, re.MULTILINE) self.re_Antes = re.compile(r"^%(PLYR)s: posts the ante (%(CUR)s)?(?P[\.0-9]+)" % subst, re.MULTILINE) self.re_BringIn = re.compile(r"^%(PLYR)s: brings[- ]in( low|) for (%(CUR)s)?(?P[\.0-9]+)" % subst, re.MULTILINE) - self.re_PostBoth = re.compile('(?P.*): posts small \& big blinds \( (%(CUR)s)?(?P[\.0-9]+)\)' % subst) + self.re_PostBoth = re.compile('(?P.*): posts small \& big blind \( (%(CUR)s)?(?P[\.0-9]+)\)' % subst) + self.re_PostDead = re.compile('(?P.*) posts dead blind \((%(CUR)s)?(?P[\.0-9]+)\)' % subst, re.MULTILINE) self.re_HeroCards = re.compile('Dealing\sto\s%(PLYR)s:\s\[(?P.*)\]' % subst) #lopllopl checks, Eurolll checks, .Lucchess checks. @@ -286,7 +287,6 @@ class OnGame(HandHistoryConverter): hand.setCommunityCards(street, m.group('CARDS').split(', ')) def readBlinds(self, hand): - #log.debug( _("readBlinds starting, hand=") + "\n["+hand.handText+"]" ) try: m = self.re_PostSB.search(hand.handText) hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB')) @@ -295,6 +295,9 @@ class OnGame(HandHistoryConverter): #hand.addBlind(None, None, None) for a in self.re_PostBB.finditer(hand.handText): hand.addBlind(a.group('PNAME'), 'big blind', a.group('BB')) + for a in self.re_PostDead.finditer(hand.handText): + #print "DEBUG: Found dead blind: addBlind(%s, 'secondsb', %s)" %(a.group('PNAME'), a.group('DEAD')) + hand.addBlind(a.group('PNAME'), 'secondsb', a.group('DEAD')) for a in self.re_PostBoth.finditer(hand.handText): hand.addBlind(a.group('PNAME'), 'small & big blinds', a.group('SBBB')) From fbfaf0176c1e0b3ef3231c08691ff9c30b22330b Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 17 Sep 2010 10:58:47 +0800 Subject: [PATCH 4/7] Import: First step to making FTP archive files parse Change regex to be explicit about the number of '*'s Pass the ftpArchive flag to HHC init --- pyfpdb/HandHistoryConverter.py | 3 ++- pyfpdb/fpdb_import.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 8eb2b9b6..c52444dd 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -266,7 +266,8 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py. if self.ftpArchive == True: log.debug(_("Converting ftpArchive format to readable")) - m = re.compile('^\*\*\*\*\*\*+\s#\s\d+\s\*\*\*\*\*+$', re.MULTILINE) + # Remove ******************** # 1 ************************* + m = re.compile('\*{20}\s#\s\d+\s\*{25}\s+', re.MULTILINE) self.obs = m.sub('', self.obs) if self.obs is None or self.obs == "": diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 102da6fc..65de8181 100755 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -473,7 +473,8 @@ class Importer: else: self.pos_in_file[file] = 0 hhc = obj( self.config, in_path = file, out_path = out_path, index = idx - , starsArchive = self.settings['starsArchive'], sitename = site ) + , starsArchive = self.settings['starsArchive'], ftpArchive = self.settings['ftpArchive'], + sitename = site ) if hhc.getStatus(): handlist = hhc.getProcessedHands() self.pos_in_file[file] = hhc.getLastCharacterRead() From 14bd76760337669ec6c47f99e36724180c2b8e80 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 17 Sep 2010 11:44:58 +0800 Subject: [PATCH 5/7] Carbon/Merge: Fix blind reading The new Merge network format has a timestamp in the blind line Also made some of the error reporting more consistent with other parsers --- pyfpdb/CarbonToFpdb.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/pyfpdb/CarbonToFpdb.py b/pyfpdb/CarbonToFpdb.py index 4d4e0aa1..abb29e30 100644 --- a/pyfpdb/CarbonToFpdb.py +++ b/pyfpdb/CarbonToFpdb.py @@ -85,8 +85,8 @@ class Carbon(HandHistoryConverter): # The following are also static regexes: there is no need to call # compilePlayerRegexes (which does nothing), since players are identified # not by name but by seat number - re_PostSB = re.compile(r'', re.MULTILINE) - re_PostBB = re.compile(r'', re.MULTILINE) + re_PostSB = re.compile(r'timestamp="[0-9]+" )?player="(?P[0-9])" amount="(?P[.0-9]+)"/>', re.MULTILINE) + re_PostBB = re.compile(r'timestamp="[0-9]+" )?player="(?P[0-9])" amount="(?P[.0-9]+)"/>', re.MULTILINE) re_PostBoth = re.compile(r'', re.MULTILINE) #re_Antes = ??? #re_BringIn = ??? @@ -170,7 +170,7 @@ or None if we fail to get the info """ if m is None: logging.info(_("Didn't match re_HandInfo")) logging.info(hand.handText) - return None + raise FpdbParseError("No match in readHandInfo.") logging.debug("HID %s-%s, Table %s" % (m.group('HID1'), m.group('HID2'), m.group('TABLE')[:-1])) hand.handid = m.group('HID1') + m.group('HID2') @@ -181,7 +181,7 @@ or None if we fail to get the info """ # Check that the hand is complete up to the awarding of the pot; if # not, the hand is unparseable if self.re_EndOfHand.search(hand.handText) is None: - raise FpdbParseError(hid=m.group('HID1') + "-" + m.group('HID2')) + raise FpdbParseError("readHandInfo failed: HID: '%s' HID2: '%s'" %(m.group('HID1'), m.group('HID2'))) def readPlayerStacks(self, hand): m = self.re_PlayerInfo.finditer(hand.handText) @@ -221,15 +221,13 @@ or None if we fail to get the info """ pass # ??? def readBlinds(self, hand): - try: - m = self.re_PostSB.search(hand.handText) - hand.addBlind(self.playerNameFromSeatNo(m.group('PSEAT'), hand), - 'small blind', m.group('SB')) - except: # no small blind - hand.addBlind(None, None, None) + for a in self.re_PostSB.finditer(hand.handText): + #print "DEBUG: found sb: '%s' '%s'" %(self.playerNameFromSeatNo(a.group('PSEAT'), hand), a.group('SB')) + hand.addBlind(self.playerNameFromSeatNo(a.group('PSEAT'), hand),'small blind', a.group('SB')) + for a in self.re_PostBB.finditer(hand.handText): - hand.addBlind(self.playerNameFromSeatNo(a.group('PSEAT'), hand), - 'big blind', a.group('BB')) + #print "DEBUG: found bb: '%s' '%s'" %(self.playerNameFromSeatNo(a.group('PSEAT'), hand), a.group('BB')) + hand.addBlind(self.playerNameFromSeatNo(a.group('PSEAT'), hand), 'big blind', a.group('BB')) for a in self.re_PostBoth.finditer(hand.handText): bb = Decimal(self.info['bb']) amount = Decimal(a.group('SBBB')) From 14ac685e3063726bb7eebcf2dbc9f42d3297fe43 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 17 Sep 2010 11:47:23 +0800 Subject: [PATCH 6/7] FTP: Adjust SplitHands regex for 2 blank lines or more Also add FpdbParseError() throe if GameInfo regex fails to match --- pyfpdb/FulltiltToFpdb.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index f94903c5..e744addd 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -61,7 +61,7 @@ class Fulltilt(HandHistoryConverter): (?P(No\sLimit|Pot\sLimit|Limit))?\s (?P(Hold\'em|Omaha\sHi|Omaha\sH/L|7\sCard\sStud|Stud\sH/L|Razz|Stud\sHi)) ''' % substitutions, re.VERBOSE) - re_SplitHands = re.compile(r"\n\n+") + re_SplitHands = re.compile(r"\n\n\n+") re_TailSplitHands = re.compile(r"(\n\n+)") re_HandInfo = re.compile(r'''.*\#(?P[0-9]+):\s (?:(?P.+)\s\((?P\d+)\),\s)? @@ -186,7 +186,10 @@ class Fulltilt(HandHistoryConverter): m = self.re_GameInfo.search(handText) if not m: - return None + tmp = handText[0:100] + log.error(_("determineGameType: Unable to recognise gametype from: '%s'") % tmp) + log.error(_("determineGameType: Raising FpdbParseError")) + raise FpdbParseError(_("Unable to recognise gametype from: '%s'") % tmp) mg = m.groupdict() # translations from captured groups to our info strings From a81910d7f1d7c4d4730536e805d7a9b206775340 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 17 Sep 2010 17:39:04 +0800 Subject: [PATCH 7/7] iPoker: Large update for actions and antes I think I have most of the action correct at the moment. --- pyfpdb/iPokerToFpdb.py | 44 ++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/pyfpdb/iPokerToFpdb.py b/pyfpdb/iPokerToFpdb.py index 32e97628..b624737b 100644 --- a/pyfpdb/iPokerToFpdb.py +++ b/pyfpdb/iPokerToFpdb.py @@ -71,17 +71,16 @@ class iPoker(HandHistoryConverter): re_GameInfo = re.compile(r'(?P[a-zA-Z0-9 ]+) \$(?P[.0-9]+)/\$(?P[.0-9]+)', re.MULTILINE) re_HandInfo = re.compile(r'gamecode="(?P[0-9]+)">\s+\s+(?P[-: 0-9]+)', re.MULTILINE) re_Button = re.compile(r'') - re_PlayerInfo = re.compile(r'win="\$[^"]+") (bet="\$(?P[^"]+))?', re.MULTILINE) re_Board = re.compile(r'', re.MULTILINE) re_PostBB = re.compile(r'', re.MULTILINE) re_PostBoth = re.compile(r'', re.MULTILINE) - #re_Antes = ??? - #re_BringIn = ??? re_HeroCards = re.compile(r'', re.MULTILINE) re_CollectPot = re.compile(r'', re.MULTILINE) @@ -135,7 +134,7 @@ or None if we fail to get the info """ self.info = {} mg = m.groupdict() - print "DEBUG: m.groupdict(): %s" % mg + #print "DEBUG: m.groupdict(): %s" % mg limits = { 'No Limit':'nl', 'Limit':'fl' } games = { # base, category @@ -167,17 +166,18 @@ or None if we fail to get the info """ logging.info(hand.handText) raise FpdbParseError(_("Didn't match re_HandInfo")) mg = m.groupdict() - print "DEBUG: m.groupdict(): %s" % mg + #print "DEBUG: m.groupdict(): %s" % mg hand.handid = m.group('HID') #hand.tablename = m.group('TABLE')[:-1] hand.maxseats = None hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), '%Y-%m-%d %H:%M:%S') def readPlayerStacks(self, hand): + print "DEBUG: readPlayerStacks" m = self.re_PlayerInfo.finditer(hand.handText) for a in m: ag = a.groupdict() - print "DEBUG: ag: %s" %ag + #print "DEBUG: re_PlayerInfo: %s" %ag seatno = int(a.group('SEAT')) # It may be necessary to adjust 'hand.maxseats', which is an # educated guess, starting with 2 (indicating a heads-up table) and @@ -213,10 +213,13 @@ or None if we fail to get the info """ hand.setCommunityCards(street, [m.group('CARDS').split(',')[-1]]) def readAntes(self, hand): - pass # ??? + m = self.re_Ante.finditer(hand.handText) + for a in m: + #print "DEBUG: addAnte(%s, %s)" %(a.group('PNAME'), a.group('BET')) + hand.addAnte(a.group('PNAME'), a.group('BET')) def readBringIn(self, hand): - pass # ??? + pass def readBlinds(self, hand): m = self.re_PostSB.search(hand.handText) @@ -241,21 +244,28 @@ or None if we fail to get the info """ m = self.re_Action.finditer(hand.streets[street]) for action in m: ag = action.groupdict() - print "DEBUG: action.groupdict: %s" % ag + #print "DEBUG: action.groupdict: %s" % ag logging.debug("%s %s" % (action.group('ATYPE'), action.groupdict())) - if action.group('ATYPE') == 'RAISE': + if action.group('ATYPE') == 'RAISE': # Still no example for raise (i think?) hand.addCallandRaise(street, player, action.group('BET')) elif action.group('ATYPE') == '3': # Believe this is 'call' + #print "DEBUG: addCall(%s, %s, %s)" %(street, action.group('PNAME'), action.group('BET')) hand.addCall(street, action.group('PNAME'), action.group('BET')) - elif action.group('ATYPE') == 'BET': - hand.addBet(street, player, action.group('BET')) + elif action.group('ATYPE') == '5': + #print "DEBUG: addBet(%s, %s, %s)" %(street, action.group('PNAME'), action.group('BET')) + hand.addBet(street, action.group('PNAME'), action.group('BET')) elif action.group('ATYPE') == '0': # Belive this is 'fold' + #print "DEBUG: addFold(%s, %s)" %(street, action.group('PNAME')) hand.addFold(street, action.group('PNAME')) - elif action.group('ATYPE') == 'CHECK': - hand.addCheck(street, player) - elif action.group('ATYPE') == 'ALL_IN': - hand.addAllIn(street, player, action.group('BET')) + elif action.group('ATYPE') == '4': + #print "DEBUG: addCheck(%s, %s)" %(street, action.group('PNAME')) + hand.addCheck(street, action.group('PNAME')) + #elif action.group('ATYPE') == 'ALL_IN': + # hand.addAllIn(street, player, action.group('BET')) + elif action.group('ATYPE') == '16': #BringIn + #print "DEBUG: addBringIn(%s, %s)" %(action.group('PNAME'), action.group('BET')) + hand.addBringIn(action.group('PNAME'), action.group('BET')) else: logging.error(_("Unimplemented readAction: %s" % (ag)))