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