From b023a9404cc80335022d33c0d9a10178a40c5088 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 30 Jan 2009 02:18:19 +0900 Subject: [PATCH 01/66] Quick commit to add the failing Full Tilt HH Header Only as a comment for now. Need to pull together all the valid Full Tilt HH lines so we can write a decent regex to match --- pyfpdb/fpdb_simple.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index e97102dd..6d018f45 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -1158,6 +1158,8 @@ def parseHandStartTime(topline, site): isUTC=False if site=="ftp": + # Full Tilt Sit'n'Go + # Full Tilt Poker Game #10311865543: $1 + $0.25 Sit & Go (78057629), Table 1 - 25/50 - No Limit Hold'em - 0:07:45 ET - 2009/01/29 pos = topline.find(" ", len(topline)-26)+1 tmp = topline[pos:] #print "year:", tmp[14:18], "month", tmp[19:21], "day", tmp[22:24], "hour", tmp[0:2], "minute", tmp[3:5], "second", tmp[6:8] From 9cd88c0399d591942aef1372414176b1207b2218 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 30 Jan 2009 13:23:09 +0900 Subject: [PATCH 02/66] Comment patch: FTP HH headers --- pyfpdb/fpdb_simple.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index 6d018f45..76c07187 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -1158,8 +1158,12 @@ def parseHandStartTime(topline, site): isUTC=False if site=="ftp": + # TODO: Turn this into a regex that matches the following # Full Tilt Sit'n'Go # Full Tilt Poker Game #10311865543: $1 + $0.25 Sit & Go (78057629), Table 1 - 25/50 - No Limit Hold'em - 0:07:45 ET - 2009/01/29 + # Cash Game: + # Full Tilt Poker Game #9403951181: Table CR - tay - $0.05/$0.10 - No Limit Hold'em - 9:40:20 ET - 2008/12/09 + # Full Tilt Poker Game #9468383505: Table Bike (deep 6) - $0.05/$0.10 - No Limit Hold'em - 5:09:36 ET - 2008/12/13 pos = topline.find(" ", len(topline)-26)+1 tmp = topline[pos:] #print "year:", tmp[14:18], "month", tmp[19:21], "day", tmp[22:24], "hour", tmp[0:2], "minute", tmp[3:5], "second", tmp[6:8] From 315d01031132faae4fb7b165054a17d7e4a3c3e7 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 5 Feb 2009 18:28:18 +0900 Subject: [PATCH 03/66] Make Everleaf converter actually function. Makes HandHistoryConverter actually write out a file to $hhArchiveBase/sitename/ Adds code in importer call the functions in EverleafToFpdb --- pyfpdb/HandHistoryConverter.py | 13 +++++++++++-- pyfpdb/fpdb_import.py | 15 +++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 7dea7731..8d7df813 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -88,7 +88,7 @@ class HandHistoryConverter: self.hhbase = os.path.expanduser(self.hhbase) self.hhdir = os.path.join(self.hhbase,sitename) self.gametype = [] -# self.ofile = os.path.join(self.hhdir,file) + self.ofile = os.path.join(self.hhdir,file) self.rexx = FpdbRegex.FpdbRegex() def __str__(self): @@ -110,6 +110,7 @@ class HandHistoryConverter: print "Cowardly refusing to continue after failed sanity check" return self.readFile(self.file) + outfile = open(self.ofile, 'w') self.gametype = self.determineGameType() self.hands = self.splitFileIntoHands() for hand in self.hands: @@ -137,13 +138,14 @@ class HandHistoryConverter: hand.totalPot() self.getRake(hand) - hand.writeHand(sys.stderr) + hand.writeHand(outfile) #if(hand.involved == True): #self.writeHand("output file", hand) #hand.printHand() #else: #pass #Don't write out observed hands + outfile.close() endtime = time.time() print "Processed %d hands in %d seconds" % (len(self.hands), endtime-starttime) @@ -259,3 +261,10 @@ class HandHistoryConverter: result*=100 return result #end def float2int + + def getStatus(self): + #TODO: Return a status of true if file processed ok + return True + + def getProcessedFile(self): + return self.ofile diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index aa68c94f..09a26665 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -39,6 +39,7 @@ import re import fpdb_db import fpdb_simple import fpdb_parse_logic +import EverleafToFpdb from time import time class Importer: @@ -156,8 +157,18 @@ class Importer: if(filter == "passthrough"): (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(file, site) else: - # TODO: Load filter, and run filtered file though main importer - (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(file, site) + conv = None + # Load filter, process file, pass returned filename to import_fpdb_file + if(filter == "EverleafToFpdb"): + conv = EverleafToFpdb(self.config, file) + + conv.readSupportedGames() # Should this be done by HHC on init? + conv.determineGameType() + conv.processFile() + if(conv.getStatus()): + (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(conv.getProcessedFile(ofile), site) + + #This will barf if conv.getStatus != True return (stored, duplicates, partial, errors, ttime) From 6214131713a1be1cba5724baab5be0c9641d3701 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 5 Feb 2009 18:50:50 +0900 Subject: [PATCH 04/66] Small change - note we should error check --- pyfpdb/EverleafToFpdb.py | 2 +- pyfpdb/HandHistoryConverter.py | 4 +++- pyfpdb/fpdb_import.py | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index 4e51213f..6d409bda 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -86,7 +86,7 @@ class Everleaf(HandHistoryConverter): self.rexx.compileRegexes() def readSupportedGames(self): - pass + return [["ring", "hold", "nl"]] def determineGameType(self): # Cheating with this regex, only support nlhe at the moment diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 8d7df813..a698c390 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -151,7 +151,9 @@ class HandHistoryConverter: ##### # These functions are parse actions that may be overridden by the inheriting class - # + # This function should return a list of lists looking like: + # return [["ring", "hold", "nl"], ["tour", "hold", "nl"]] + # Showing all supported games limits and types def readSupportedGames(self): abstract diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 09a26665..b9a8f0bf 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -162,8 +162,9 @@ class Importer: if(filter == "EverleafToFpdb"): conv = EverleafToFpdb(self.config, file) - conv.readSupportedGames() # Should this be done by HHC on init? - conv.determineGameType() + supp = conv.readSupportedGames() # Should this be done by HHC on init? + gt = conv.determineGameType() + # TODO: Check that gt is in supp - error appropriately if not conv.processFile() if(conv.getStatus()): (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(conv.getProcessedFile(ofile), site) From d2159b6430d6ccbf864d81975c1fdc044b317313 Mon Sep 17 00:00:00 2001 From: eblade Date: Thu, 19 Feb 2009 05:38:51 -0500 Subject: [PATCH 05/66] changes to make auto-import recursive, and to get the converter thingee kind of working --- pyfpdb/HandHistoryConverter.py | 4 ++-- pyfpdb/fpdb_import.py | 24 ++++++++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index a698c390..9b22f42b 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -28,7 +28,7 @@ import codecs from decimal import Decimal import operator from xml.dom.minidom import Node -from pokereval import PokerEval +# from pokereval import PokerEval import time import datetime import gettext @@ -74,7 +74,7 @@ gettext.install('myapplication') class HandHistoryConverter: - eval = PokerEval() +# eval = PokerEval() def __init__(self, config, file, sitename): print "HandHistory init called" self.c = config diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 1d46430a..304402ad 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -59,6 +59,7 @@ class Importer: self.cursor = None self.filelist = {} self.dirlist = {} + self.addToDirList = {} self.monitor = False self.updated = {} #Time last import was run {file:mtime} self.lines = None @@ -180,18 +181,33 @@ class Importer: self.updated[file] = time() # This codepath only runs first time the file is found, if modified in the last # minute run an immediate import. - if (time() - stat_info.st_mtime) < 60: # TODO: figure out a way to dispatch this to the seperate thread so our main window doesn't lock up on initial import + if (time() - stat_info.st_mtime) < 60 or os.path.isdir(file): # TODO: figure out a way to dispatch this to the seperate thread so our main window doesn't lock up on initial import self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) + + for dir in self.addToDirList: + self.addImportDirectory(dir, True, self.addToDirList[dir][0], self.addToDirList[dir][1]) + + self.addToDirList = {} # This is now an internal function that should not be called directly. def import_file_dict(self, file, site, filter): - if(filter == "passthrough"): + if os.path.isdir(file): + self.addToDirList[file] = [site] + [filter] + return + if filter == "passthrough" or filter == "": (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(file, site) else: conv = None # Load filter, process file, pass returned filename to import_fpdb_file - if(filter == "EverleafToFpdb"): - conv = EverleafToFpdb(self.config, file) + + # TODO: Shouldn't we be able to use some sort of lambda or something to just call a Python object by whatever name we specify? then we don't have to hardcode them, + # someone can just create their own python module for it + if filter == "EverleafToFpdb": + print "converting ", file + conv = EverleafToFpdb.Everleaf(self.config, file) + else: + print "Unknown filter ", filter + return supp = conv.readSupportedGames() # Should this be done by HHC on init? gt = conv.determineGameType() From 2a90c798a245cec901af39b73fa5a8824f1f7407 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 19 Feb 2009 20:35:05 +0900 Subject: [PATCH 06/66] Make executable --- pyfpdb/GuiBulkImport.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 pyfpdb/GuiBulkImport.py diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py old mode 100644 new mode 100755 From 50ca5d54574d3ce1ae7c1d833487e412159972ce Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 19 Feb 2009 21:15:12 +0900 Subject: [PATCH 07/66] Fix tab/spacing --- pyfpdb/Configuration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 9b8f4f08..a9a884a7 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -189,7 +189,7 @@ class Import: def __init__(self, node): self.interval = node.getAttribute("interval") self.callFpdbHud = node.getAttribute("callFpdbHud") - self.hhArchiveBase = node.getAttribute("hhArchiveBase") + self.hhArchiveBase = node.getAttribute("hhArchiveBase") def __str__(self): return " interval = %s\n callFpdbHud = %s\n hhArchiveBase = %s" % (self.interval, self.callFpdbHud, self.hhArchiveBase) @@ -665,4 +665,4 @@ if __name__== "__main__": for game in c.get_supported_games(): print c.get_game_parameters(game) - print "start up path = ", c.execution_path("") \ No newline at end of file + print "start up path = ", c.execution_path("") From 98ea23cd49eaffa293c6e100b2de5f2dad627050 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 19 Feb 2009 22:10:31 +0900 Subject: [PATCH 08/66] Couple of additional fixes for import --- pyfpdb/fpdb_import.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 304402ad..e2e5302e 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -210,11 +210,11 @@ class Importer: return supp = conv.readSupportedGames() # Should this be done by HHC on init? - gt = conv.determineGameType() + #gt = conv.determineGameType() # TODO: Check that gt is in supp - error appropriately if not conv.processFile() if(conv.getStatus()): - (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(conv.getProcessedFile(ofile), site) + (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(conv.getProcessedFile(), site) #This will barf if conv.getStatus != True return (stored, duplicates, partial, errors, ttime) From bc8f1b56b69987dc40fb28ae98fe266568b33de1 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 19 Feb 2009 22:58:29 +0900 Subject: [PATCH 09/66] Remove Unicode mode from file read. Hope this fixes the issue with Erics source file getting nuked --- pyfpdb/HandHistoryConverter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 9b22f42b..9af87d62 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -237,7 +237,7 @@ class HandHistoryConverter: """Read file""" print "Reading file: '%s'" %(filename) if(self.filetype == "text"): - infile=codecs.open(filename, "rU", self.codepage) + infile=codecs.open(filename, "r", self.codepage) self.obs = infile.read() infile.close() elif(self.filetype == "xml"): From d9656b25f604bb3da1f9a7e449ac70f2fc53a632 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 20 Feb 2009 01:37:48 +0900 Subject: [PATCH 10/66] Oversight in Hand.py (?) Bp missing in this function, and doesn't run if called. No idea if the function has ever been called. --- pyfpdb/Hand.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 24ccbe3f..4726eaa9 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -265,6 +265,7 @@ For sites which by "raises x" mean "calls and raises putting a total of x in the Add a raise on [street] by [player] to [amountTo] """ self.checkPlayerExists(player) + Bp = self.lastBet[street] Bc = reduce(operator.add, self.bets[street][player], 0) Rt = Decimal(amountTo) C = Bp - Bc From 08a4d568cc687e0a3fbd795bfb0142af97a88dfc Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 20 Feb 2009 02:26:29 +0900 Subject: [PATCH 11/66] Fix parseHandStartTime for FullTilt Doesn't come close to fixing Full Tilt tourneys as far as i can tell. --- pyfpdb/Hand.py | 1 + pyfpdb/HandHistoryConverter.py | 2 ++ pyfpdb/RegressionTest.py | 15 +++++++++++++++ pyfpdb/fpdb_simple.py | 7 ++++--- 4 files changed, 22 insertions(+), 3 deletions(-) mode change 100644 => 100755 pyfpdb/RegressionTest.py diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 4726eaa9..7cadbf3d 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -264,6 +264,7 @@ For sites which by "raises x" mean "calls and raises putting a total of x in the """\ Add a raise on [street] by [player] to [amountTo] """ + #CG - No idea if this function has been test/verified self.checkPlayerExists(player) Bp = self.lastBet[street] Bc = reduce(operator.add, self.bets[street][player], 0) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 9af87d62..f7b1e482 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -110,6 +110,8 @@ class HandHistoryConverter: print "Cowardly refusing to continue after failed sanity check" return self.readFile(self.file) + # Ugh + self.obs = self.obs.replace('\r\n', '\n') outfile = open(self.ofile, 'w') self.gametype = self.determineGameType() self.hands = self.splitFileIntoHands() diff --git a/pyfpdb/RegressionTest.py b/pyfpdb/RegressionTest.py old mode 100644 new mode 100755 index 6acc8a74..d52b6aca --- a/pyfpdb/RegressionTest.py +++ b/pyfpdb/RegressionTest.py @@ -90,6 +90,21 @@ class TestSequenceFunctions(unittest.TestCase): self.failUnless(result==datetime.datetime(2008,8,17,6,14,43), "Date incorrect, expected: 2008-08-17 01:14:43 got: " + str(result)) + def testFullTiltHHDate(self): + sitngo1 = "Full Tilt Poker Game #10311865543: $1 + $0.25 Sit & Go (78057629), Table 1 - 25/50 - No Limit Hold'em - 0:07:45 ET - 2009/01/29" + cash1 = "Full Tilt Poker Game #9403951181: Table CR - tay - $0.05/$0.10 - No Limit Hold'em - 9:40:20 ET - 2008/12/09" + cash2 = "Full Tilt Poker Game #9468383505: Table Bike (deep 6) - $0.05/$0.10 - No Limit Hold'em - 5:09:36 ET - 2008/12/13" + + result = fpdb_simple.parseHandStartTime(sitngo1,"ftp") + self.failUnless(result==datetime.datetime(2009,1,29,05,07,45), + "Date incorrect, expected: 2009-01-29 05:07:45 got: " + str(result)) + result = fpdb_simple.parseHandStartTime(cash1,"ftp") + self.failUnless(result==datetime.datetime(2008,12,9,14,40,20), + "Date incorrect, expected: 2008-12-09 14:40:20 got: " + str(result)) + result = fpdb_simple.parseHandStartTime(cash2,"ftp") + self.failUnless(result==datetime.datetime(2008,12,13,10,9,36), + "Date incorrect, expected: 2008-12-13 10:09:36 got: " + str(result)) + def testTableDetection(self): result = Tables.clean_title("French (deep)") self.failUnless(result == "French", "French (deep) parsed incorrectly. Expected 'French' got: " + str(result)) diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index 76c07187..b0231ecf 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -1158,7 +1158,6 @@ def parseHandStartTime(topline, site): isUTC=False if site=="ftp": - # TODO: Turn this into a regex that matches the following # Full Tilt Sit'n'Go # Full Tilt Poker Game #10311865543: $1 + $0.25 Sit & Go (78057629), Table 1 - 25/50 - No Limit Hold'em - 0:07:45 ET - 2009/01/29 # Cash Game: @@ -1166,8 +1165,10 @@ def parseHandStartTime(topline, site): # Full Tilt Poker Game #9468383505: Table Bike (deep 6) - $0.05/$0.10 - No Limit Hold'em - 5:09:36 ET - 2008/12/13 pos = topline.find(" ", len(topline)-26)+1 tmp = topline[pos:] - #print "year:", tmp[14:18], "month", tmp[19:21], "day", tmp[22:24], "hour", tmp[0:2], "minute", tmp[3:5], "second", tmp[6:8] - result = datetime.datetime(int(tmp[14:18]), int(tmp[19:21]), int(tmp[22:24]), int(tmp[0:2]), int(tmp[3:5]), int(tmp[6:8])) + + rexx = '(?P
[0-9]+):(?P[0-9]+):(?P[0-9]+) ET [\- ]+(?P[0-9]{4})\/(?P[0-9]{2})\/(?P[0-9]{2})' + m = re.search(rexx,tmp) + result = datetime.datetime(int(m.group('YEAR')), int(m.group('MON')), int(m.group('DAY')), int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC'))) elif site=="ps": if topline.find("UTC")!=-1: pos1 = topline.find("-")+2 From 14cf64f81b54023f6ded11c92e990aad57aca24f Mon Sep 17 00:00:00 2001 From: eblade Date: Thu, 19 Feb 2009 16:56:37 -0500 Subject: [PATCH 12/66] HHC will return without generating python errors if given an empty input, commented out echoing the input --- pyfpdb/HandHistoryConverter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 9b22f42b..a92163ab 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -110,11 +110,14 @@ class HandHistoryConverter: print "Cowardly refusing to continue after failed sanity check" return self.readFile(self.file) + if self.obs == "" or self.obs == None: + print "Did not read anything from file." + return outfile = open(self.ofile, 'w') self.gametype = self.determineGameType() self.hands = self.splitFileIntoHands() for hand in self.hands: - print "\nInput:\n"+hand.string +# print "\nInput:\n"+hand.string self.readHandInfo(hand) self.readPlayerStacks(hand) print "DEBUG stacks:", hand.stacks From e5ab933659dc29f208c4027a17450d483189226b Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 20 Feb 2009 16:06:22 +0900 Subject: [PATCH 13/66] Fix major bug in fpdb_import Hat tip to Eric --- pyfpdb/HandHistoryConverter.py | 2 +- pyfpdb/fpdb_import.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index f7b1e482..a3179918 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -88,7 +88,7 @@ class HandHistoryConverter: self.hhbase = os.path.expanduser(self.hhbase) self.hhdir = os.path.join(self.hhbase,sitename) self.gametype = [] - self.ofile = os.path.join(self.hhdir,file) + self.ofile = os.path.join(self.hhdir, os.path.basename(file)) self.rexx = FpdbRegex.FpdbRegex() def __str__(self): diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index e2e5302e..e5dafe4c 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -205,6 +205,9 @@ class Importer: if filter == "EverleafToFpdb": print "converting ", file conv = EverleafToFpdb.Everleaf(self.config, file) + elif filter == "FulltiltToFpdb": + print "converting ", file + conv = FulltiltToFpdb.Fulltilt(self.config, file) else: print "Unknown filter ", filter return From 77591788e41b3806b3af9381c2dc8d8fb3e5fe58 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 20 Feb 2009 16:38:13 +0900 Subject: [PATCH 14/66] Minor regex update for raises in Everleaf --- pyfpdb/EverleafToFpdb.py | 2 +- pyfpdb/Hand.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index 6d409bda..263ea9d5 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -78,7 +78,7 @@ class Everleaf(HandHistoryConverter): self.rexx.setPostBbRegex('.*\n(?P.*): posts big blind \[\$? (?P[.0-9]+)') self.rexx.setPostBothRegex('.*\n(?P.*): posts small \& big blinds \[\$? (?P[.0-9]+)') self.rexx.setHeroCardsRegex('.*\nDealt\sto\s(?P.*)\s\[ (?P.*) \]') - self.rexx.setActionStepRegex('.*\n(?P.*)(?P: bets| checks| raises| calls| folds)(\s\[\$ (?P[.\d]+) (USD|EUR)\])?') + self.rexx.setActionStepRegex('.*\n(?P.*)(?P: bets| checks|: raises| calls| folds)(\s\[\$ (?P[.\d]+) (USD|EUR)\])?') self.rexx.setShowdownActionRegex('.*\n(?P.*) shows \[ (?P.*) \]') self.rexx.setCollectPotRegex('.*\n(?P.*) wins \$ (?P[.\d]+) (USD|EUR)(.*?\[ (?P.*?) \])?') #self.rexx.setCollectPotRegex('.*\n(?P.*) wins \$ (?P[.\d]+) USD(.*\[ (?P) \S\S, \S\S, \S\S, \S\S, \S\S \])?') diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 7cadbf3d..aede8974 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -158,6 +158,7 @@ Card ranks will be uppercased def checkPlayerExists(self,player): + print "XXXX player: ", player if player not in [p[1] for p in self.players]: raise FpdbParseError From 65821dbd2b01cfb1c11b123d617f8dccc9e4c1d2 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 20 Feb 2009 16:42:57 +0900 Subject: [PATCH 15/66] Remove debug line that slipped thorugh in last commit --- pyfpdb/Hand.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index aede8974..7cadbf3d 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -158,7 +158,6 @@ Card ranks will be uppercased def checkPlayerExists(self,player): - print "XXXX player: ", player if player not in [p[1] for p in self.players]: raise FpdbParseError From fe5045b14f91fa2da0f800cf51ef5b776d005d37 Mon Sep 17 00:00:00 2001 From: eblade Date: Fri, 20 Feb 2009 02:44:06 -0500 Subject: [PATCH 16/66] hand error in checkPlayerExists will tell you why it failed --- pyfpdb/Hand.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 7cadbf3d..e8546237 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -159,6 +159,7 @@ Card ranks will be uppercased def checkPlayerExists(self,player): if player not in [p[1] for p in self.players]: + print "checkPlayerExists", player, "fail" raise FpdbParseError def discardHoleCards(self, cards, player): From 81c92f959948e44d6b62ea1b1bbb403dfe4ade8a Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 20 Feb 2009 17:22:58 +0900 Subject: [PATCH 17/66] Revert last change and try alternate Assumes that the player names cannot have a ':' or a ' ' in them --- pyfpdb/EverleafToFpdb.py | 2 +- pyfpdb/Hand.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index 263ea9d5..7a5344c2 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -78,7 +78,7 @@ class Everleaf(HandHistoryConverter): self.rexx.setPostBbRegex('.*\n(?P.*): posts big blind \[\$? (?P[.0-9]+)') self.rexx.setPostBothRegex('.*\n(?P.*): posts small \& big blinds \[\$? (?P[.0-9]+)') self.rexx.setHeroCardsRegex('.*\nDealt\sto\s(?P.*)\s\[ (?P.*) \]') - self.rexx.setActionStepRegex('.*\n(?P.*)(?P: bets| checks|: raises| calls| folds)(\s\[\$ (?P[.\d]+) (USD|EUR)\])?') + self.rexx.setActionStepRegex('.*\n(?P[^: ]*)(?P: bets| checks| raises| calls| folds)(\s\[\$ (?P[.\d]+) (USD|EUR)\])?') self.rexx.setShowdownActionRegex('.*\n(?P.*) shows \[ (?P.*) \]') self.rexx.setCollectPotRegex('.*\n(?P.*) wins \$ (?P[.\d]+) (USD|EUR)(.*?\[ (?P.*?) \])?') #self.rexx.setCollectPotRegex('.*\n(?P.*) wins \$ (?P[.\d]+) USD(.*\[ (?P) \S\S, \S\S, \S\S, \S\S, \S\S \])?') diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 7cadbf3d..ec03fc27 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -544,11 +544,11 @@ class Pot(object): #print "returning %f to %s" % (lastbet, returnto) self.total -= lastbet self.committed[returnto] -= lastbet - - + + # Work out side pots commitsall = sorted([(v,k) for (k,v) in self.committed.items() if v >0]) - + self.pots = [] while len(commitsall) > 0: commitslive = [(v,k) for (v,k) in commitsall if k in self.contenders] From b8f88661f39af75e347400884fff6b00e82b7abf Mon Sep 17 00:00:00 2001 From: eblade Date: Fri, 20 Feb 2009 03:33:25 -0500 Subject: [PATCH 18/66] Add comment to Hand.py, around addCollectPot(). Please look at that, Matt. --- pyfpdb/Hand.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 35476bdf..b902dd67 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -308,6 +308,13 @@ Add a raise on [street] by [player] to [amountTo] self.checkPlayerExists(player) self.actions[street].append((player, 'checks')) +# dart1 wins $ 51.09 USD from main pot with a full house, queens full of threes [ Qh, Qc, Qd, 3c, 3s ] +# dart1 wins $ 41.07 USD from side pot with a full house, queens full of threes [ Qh, Qc, Qd, 3c, 3s ] +# DEBUG: dart1 collected 51.09 +# DEBUG: dart1 collected 41.07 +# [WARNING] %s collected pot more than once; avoidable by reading winnings only from summary lines? +# TODO: Should we just add the pots together?? + def addCollectPot(self,player, pot): print "DEBUG: %s collected %s" % (player, pot) self.checkPlayerExists(player) From 483e17734643e4f97bf8e6e9f387037c25b12d1c Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Fri, 20 Feb 2009 16:29:52 +0000 Subject: [PATCH 19/66] Explicit matching of player names About the only place where we are guaranteed to get all the players' names correctly is in the seating plan in the hand header. We extract the names and build a regex that matches only the names. We only do this if the current regex is out of date, to avoid recompiling them too often. I also did away with self.rexx because it seemed unnecessary and was difficult to work with. --- pyfpdb/EverleafToFpdb.py | 68 ++++++++++++++++++---------------- pyfpdb/GuiAutoImport.py | 2 +- pyfpdb/HandHistoryConverter.py | 39 +++++++++---------- pyfpdb/fpdb_import.py | 4 ++ 4 files changed, 61 insertions(+), 52 deletions(-) diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index 7a5344c2..9fbf91d0 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -70,20 +70,24 @@ class Everleaf(HandHistoryConverter): HandHistoryConverter.__init__(self, config, file, sitename="Everleaf") # Call super class init. self.sitename = "Everleaf" self.setFileType("text", "cp1252") - self.rexx.setGameInfoRegex('.*Blinds \$?(?P[.0-9]+)/\$?(?P[.0-9]+)') - self.rexx.setSplitHandRegex('\n\n+') - self.rexx.setHandInfoRegex('.*#(?P[0-9]+)\n.*\nBlinds \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (?P.*) - (?P\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P[ a-zA-Z]+)\nSeat (?P
[ a-zA-Z]+)\nSeat (?P
[ a-zA-Z]+)\nSeat (?P
[ a-zA-Z]+)\nSeat (?P
[- a-zA-Z]+)\nSeat (?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P[a-zA-Z\' ]+) - (?P.*)') -# self.rexx.setHandInfoRegex('.*#(?P[0-9]+): Table (?P
[ a-zA-Z]+) - \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P.*) - (?P
[0-9]+):(?P[0-9]+) ET - (?P[0-9]+)/(?P[0-9]+)/(?P[0-9]+)Table (?P
[ a-zA-Z]+)\nSeat (?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P[a-zA-Z\' ]+) - (?P.*)') + self.re_Button = re.compile('The button is in seat #(?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P[a-zA-Z\' ]+) - (?P.*)') self.re_Button = re.compile('The button is in seat #(?P
[- a-zA-Z]+)\nSeat (?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P[a-zA-Z\' ]+) - (?P.*)') + self.re_HandInfo = re.compile('.*#(?P[0-9]+): Table (?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (Ante \$(?P[.0-9]+) )?- (?P[a-zA-Z\' ]+) - (?P.*)') self.re_Button = re.compile('The button is in seat #(?P
[- a-zA-Z]+)\nSeat (?P
[- a-zA-Z]+)") + re_Button = re.compile(r"^Seat (?P
[- a-zA-Z]+)\nSeat (?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (Ante \$(?P[.0-9]+) )?- (?P[a-zA-Z\' ]+) - (?P.*)') + re_Button = re.compile('^The button is in seat #(?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (Ante \$(?P[.0-9]+) )?- (?P[a-zA-Z\' ]+) - (?P.*)') - self.re_Button = re.compile('The button is in seat #(?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (Ante \$(?P[.0-9]+) )?- (?P[a-zA-Z\' ]+) - (?P.*)') - re_Button = re.compile('^The button is in seat #(?P