From 2a90c798a245cec901af39b73fa5a8824f1f7407 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 19 Feb 2009 20:35:05 +0900 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 5/6] 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 6/6] 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