Tourney Graphing and Summary import update

It now gets through my 200 tourney torture test.
This commit is contained in:
Worros 2010-09-04 20:06:24 +08:00
parent e66b98b345
commit 016b0ed48f
5 changed files with 27 additions and 22 deletions

View File

@ -268,7 +268,7 @@ class GuiTourneyGraphViewer (threading.Thread):
if len(winnings) == 0:
return None
green = map(lambda x:float(x[0]), winnings)
green = map(lambda x:float(x[1]), winnings)
#blue = map(lambda x: float(x[1]) if x[2] == True else 0.0, winnings)
#red = map(lambda x: float(x[1]) if x[2] == False else 0.0, winnings)
greenline = cumsum(green)

View File

@ -119,6 +119,7 @@ def runFake(db, config, infile):
for summary in summaryList[1:]:
result = PokerStarsSummary.PokerStarsSummary(db=db, config=config, siteName=u"PokerStars", summaryText=summary, builtFrom = "file")
print "DEBUG: Processed: %s: tournNo: %s" % (result.tourneyId, result.tourNo)
def splitPokerStarsSummaries(emailText):
splitSummaries=emailText.split("\nPokerStars Tournament #")[1:]
@ -136,7 +137,7 @@ def main(argv=None):
sys.exit(0)
# These options should really come from the OptionsParser
config = Configuration.Config(file = "HUD_config.test.xml")
config = Configuration.Config()
db = Database.Database(config)
sql = SQL.Sql(db_server = 'sqlite')
settings = {}

View File

@ -65,12 +65,15 @@ class PokerStarsSummary(TourneySummary):
\#(?P<TOURNO>[0-9]+),\s
(?P<LIMIT>No\sLimit|Limit|LIMIT|Pot\sLimit)\s
(?P<GAME>Hold\'em|Razz|RAZZ|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)\s
Buy-In:\s\$(?P<BUYIN>[.0-9]+)\/\$(?P<FEE>[.0-9]+)\s
(?P<DESC>[ a-zA-Z]+\s)?
(Buy-In:\s\$(?P<BUYIN>[.0-9]+)(\/\$(?P<FEE>[.0-9]+))?\s)?
(?P<ENTRIES>[0-9]+)\splayers\s
Total\sPrize\sPool:\s\$?(?P<PRIZEPOOL>[.0-9]+)\s
(\$?(?P<ADDED>[.\d]+)\sadded\sto\sthe\sprize\spool\sby\sPokerStars\.com\s)?
(Total\sPrize\sPool:\s\$?(?P<PRIZEPOOL>[.0-9]+)\s)?
(Target\sTournament\s.*)?
Tournament\sstarted\s-\s
(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\-\s]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\s?\(?(?P<TZ>[A-Z]+)\)\s
""" % substitutions ,re.VERBOSE|re.MULTILINE)
""" % substitutions ,re.VERBOSE|re.MULTILINE|re.DOTALL)
re_Currency = re.compile(u"""(?P<CURRENCY>[%(LS)s]|FPP)""" % substitutions)
@ -190,22 +193,23 @@ class PokerStarsSummary(TourneySummary):
#end def parseSummary
def parseSummaryFile(self):
print self.summaryText
m = self.re_TourneyInfo.search(self.summaryText)
if m:
print "DEBUG: m.groupdict(): %s" % m.groupdict()
else:
tmp = self.summaryText[0:100]
if m == None:
tmp = self.summaryText[0:200]
log.error(_("parseSummaryFile: Unable to recognise Tourney Info: '%s'") % tmp)
log.error(_("parseSummaryFile: Raising FpdbParseError"))
raise FpdbParseError(_("Unable to recognise Tourney Info: '%s'") % tmp)
#print "DEBUG: m.groupdict(): %s" % m.groupdict()
mg = m.groupdict()
if 'TOURNO' in mg: self.tourNo = mg['TOURNO']
if 'LIMIT' in mg: self.gametype['limitType'] = self.limits[mg['LIMIT']]
if 'GAME' in mg: self.gametype['category'] = self.games[mg['GAME']][1]
if 'BUYIN' in mg: self.buyin = int(100*Decimal(mg['BUYIN']))
if 'FEE' in mg: self.fee = int(100*Decimal(mg['FEE']))
if mg['BUYIN'] != None:
self.buyin = int(100*Decimal(mg['BUYIN']))
if mg['FEE'] != None:
self.fee = int(100*Decimal(mg['FEE']))
if 'PRIZEPOOL' in mg: self.prizepool = mg['PRIZEPOOL']
if 'ENTRIES' in mg: self.entries = mg['ENTRIES']
@ -217,12 +221,11 @@ class PokerStarsSummary(TourneySummary):
m = self.re_Currency.search(self.summaryText)
if m:
print "DEBUG: m.groupdict(): %s" % m.groupdict()
else:
if m == None:
log.error(_("parseSummaryFile: Unable to locate currency"))
log.error(_("parseSummaryFile: Raising FpdbParseError"))
raise FpdbParseError(_("Unable to locate currency"))
#print "DEBUG: m.groupdict(): %s" % m.groupdict()
mg = m.groupdict()
if mg['CURRENCY'] == "$": self.currency = "USD"
@ -232,7 +235,7 @@ class PokerStarsSummary(TourneySummary):
m = self.re_Player.finditer(self.summaryText)
for a in m:
mg = a.groupdict()
print "DEBUG: a.groupdict(): %s" % mg
#print "DEBUG: a.groupdict(): %s" % mg
name = mg['NAME']
rank = mg['RANK']
winnings = 0
@ -240,15 +243,16 @@ class PokerStarsSummary(TourneySummary):
if 'WINNINGS' in mg and mg['WINNINGS'] != None:
winnings = int(100*Decimal(mg['WINNINGS']))
if 'STILLPLAYING' in mg:
if 'STILLPLAYING' in mg and mg['STILLPLAYING'] != None:
#print "stillplaying"
rank=None
winnings=None
#TODO: currency, ko/addon/rebuy count -> need examples!
#print "DEBUG: addPlayer(%s, %s, %s, %s, None, None, None)" %(rank, name, winnings, self.currency)
#print "DEBUG: self.buyin: %s self.fee %s" %(self.buyin, self.fee)
self.addPlayer(rank, name, winnings, self.currency, None, None, None)
print self
sys.exit(0)
#print self
#end class PokerStarsSummary

View File

@ -3050,7 +3050,7 @@ class Sql:
# Tourney Results query
####################################
self.query['tourneyResults'] = """
SELECT (tp.winnings - tt.buyIn - tt.fee) as profit, tp.koCount, tp.rebuyCount, tp.addOnCount, tt.buyIn, tt.fee
SELECT tp.tourneyId, (tp.winnings - tt.buyIn - tt.fee) as profit, tp.koCount, tp.rebuyCount, tp.addOnCount, tt.buyIn, tt.fee, t.siteTourneyNo
FROM TourneysPlayers tp
INNER JOIN Players pl ON (pl.id = tp.playerId)
INNER JOIN Tourneys t ON (t.id = tp.tourneyId)

View File

@ -74,8 +74,8 @@ class TourneySummary(object):
self.endTime = None
self.tourNo = None
self.currency = None
self.buyin = None
self.fee = None
self.buyin = 0
self.fee = 0
self.hero = None
self.maxseats = 0
self.entries = 0