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("") diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py old mode 100644 new mode 100755 diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 24ccbe3f..7cadbf3d 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -264,7 +264,9 @@ 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) Rt = Decimal(amountTo) C = Bp - Bc diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index a92163ab..367f786b 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -113,6 +113,8 @@ class HandHistoryConverter: if self.obs == "" or self.obs == None: print "Did not read anything from file." return + # Ugh + self.obs = self.obs.replace('\r\n', '\n') outfile = open(self.ofile, 'w') self.gametype = self.determineGameType() self.hands = self.splitFileIntoHands() @@ -240,7 +242,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"): 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_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) 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