Merge branch 'master' of git://git.assembla.com/fpdboz.git

Conflicts:
	pyfpdb/HandHistoryConverter.py
This commit is contained in:
eblade 2009-02-19 16:59:28 -05:00
commit 71b47c237a
7 changed files with 28 additions and 8 deletions

View File

@ -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("")
print "start up path = ", c.execution_path("")

0
pyfpdb/GuiBulkImport.py Normal file → Executable file
View File

View File

@ -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

View File

@ -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"):

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),
"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))

View File

@ -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)

View File

@ -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<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":
if topline.find("UTC")!=-1:
pos1 = topline.find("-")+2