Fix parseHandStartTime for FullTilt

Doesn't come close to fixing Full Tilt tourneys as far as i can tell.
This commit is contained in:
Worros 2009-02-20 02:26:29 +09:00
parent d9656b25f6
commit 08a4d568cc
4 changed files with 22 additions and 3 deletions

View File

@ -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] Add a raise on [street] by [player] to [amountTo]
""" """
#CG - No idea if this function has been test/verified
self.checkPlayerExists(player) self.checkPlayerExists(player)
Bp = self.lastBet[street] Bp = self.lastBet[street]
Bc = reduce(operator.add, self.bets[street][player], 0) Bc = reduce(operator.add, self.bets[street][player], 0)

View File

@ -110,6 +110,8 @@ class HandHistoryConverter:
print "Cowardly refusing to continue after failed sanity check" print "Cowardly refusing to continue after failed sanity check"
return return
self.readFile(self.file) self.readFile(self.file)
# Ugh
self.obs = self.obs.replace('\r\n', '\n')
outfile = open(self.ofile, 'w') outfile = open(self.ofile, 'w')
self.gametype = self.determineGameType() self.gametype = self.determineGameType()
self.hands = self.splitFileIntoHands() self.hands = self.splitFileIntoHands()

15
pyfpdb/RegressionTest.py Normal file → Executable file
View File

@ -90,6 +90,21 @@ class TestSequenceFunctions(unittest.TestCase):
self.failUnless(result==datetime.datetime(2008,8,17,6,14,43), self.failUnless(result==datetime.datetime(2008,8,17,6,14,43),
"Date incorrect, expected: 2008-08-17 01:14:43 got: " + str(result)) "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): def testTableDetection(self):
result = Tables.clean_title("French (deep)") result = Tables.clean_title("French (deep)")
self.failUnless(result == "French", "French (deep) parsed incorrectly. Expected 'French' got: " + str(result)) self.failUnless(result == "French", "French (deep) parsed incorrectly. Expected 'French' got: " + str(result))

View File

@ -1158,7 +1158,6 @@ def parseHandStartTime(topline, site):
isUTC=False isUTC=False
if site=="ftp": if site=="ftp":
# TODO: Turn this into a regex that matches the following
# Full Tilt Sit'n'Go # 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 # 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: # 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 # 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 pos = topline.find(" ", len(topline)-26)+1
tmp = topline[pos:] 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<HR>[0-9]+):(?P<MIN>[0-9]+):(?P<SEC>[0-9]+) ET [\- ]+(?P<YEAR>[0-9]{4})\/(?P<MON>[0-9]{2})\/(?P<DAY>[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": elif site=="ps":
if topline.find("UTC")!=-1: if topline.find("UTC")!=-1:
pos1 = topline.find("-")+2 pos1 = topline.find("-")+2