Tourney Graphing and Summary import update
It now gets through my 200 tourney torture test.
This commit is contained in:
parent
e66b98b345
commit
016b0ed48f
|
@ -268,7 +268,7 @@ class GuiTourneyGraphViewer (threading.Thread):
|
||||||
if len(winnings) == 0:
|
if len(winnings) == 0:
|
||||||
return None
|
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)
|
#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)
|
#red = map(lambda x: float(x[1]) if x[2] == False else 0.0, winnings)
|
||||||
greenline = cumsum(green)
|
greenline = cumsum(green)
|
||||||
|
|
|
@ -119,6 +119,7 @@ def runFake(db, config, infile):
|
||||||
|
|
||||||
for summary in summaryList[1:]:
|
for summary in summaryList[1:]:
|
||||||
result = PokerStarsSummary.PokerStarsSummary(db=db, config=config, siteName=u"PokerStars", summaryText=summary, builtFrom = "file")
|
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):
|
def splitPokerStarsSummaries(emailText):
|
||||||
splitSummaries=emailText.split("\nPokerStars Tournament #")[1:]
|
splitSummaries=emailText.split("\nPokerStars Tournament #")[1:]
|
||||||
|
@ -136,7 +137,7 @@ def main(argv=None):
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# These options should really come from the OptionsParser
|
# These options should really come from the OptionsParser
|
||||||
config = Configuration.Config(file = "HUD_config.test.xml")
|
config = Configuration.Config()
|
||||||
db = Database.Database(config)
|
db = Database.Database(config)
|
||||||
sql = SQL.Sql(db_server = 'sqlite')
|
sql = SQL.Sql(db_server = 'sqlite')
|
||||||
settings = {}
|
settings = {}
|
||||||
|
|
|
@ -65,12 +65,15 @@ class PokerStarsSummary(TourneySummary):
|
||||||
\#(?P<TOURNO>[0-9]+),\s
|
\#(?P<TOURNO>[0-9]+),\s
|
||||||
(?P<LIMIT>No\sLimit|Limit|LIMIT|Pot\sLimit)\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
|
(?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
|
(?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
|
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
|
(?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)
|
re_Currency = re.compile(u"""(?P<CURRENCY>[%(LS)s]|FPP)""" % substitutions)
|
||||||
|
|
||||||
|
@ -190,22 +193,23 @@ class PokerStarsSummary(TourneySummary):
|
||||||
#end def parseSummary
|
#end def parseSummary
|
||||||
|
|
||||||
def parseSummaryFile(self):
|
def parseSummaryFile(self):
|
||||||
print self.summaryText
|
|
||||||
m = self.re_TourneyInfo.search(self.summaryText)
|
m = self.re_TourneyInfo.search(self.summaryText)
|
||||||
if m:
|
if m == None:
|
||||||
print "DEBUG: m.groupdict(): %s" % m.groupdict()
|
tmp = self.summaryText[0:200]
|
||||||
else:
|
|
||||||
tmp = self.summaryText[0:100]
|
|
||||||
log.error(_("parseSummaryFile: Unable to recognise Tourney Info: '%s'") % tmp)
|
log.error(_("parseSummaryFile: Unable to recognise Tourney Info: '%s'") % tmp)
|
||||||
log.error(_("parseSummaryFile: Raising FpdbParseError"))
|
log.error(_("parseSummaryFile: Raising FpdbParseError"))
|
||||||
raise FpdbParseError(_("Unable to recognise Tourney Info: '%s'") % tmp)
|
raise FpdbParseError(_("Unable to recognise Tourney Info: '%s'") % tmp)
|
||||||
|
|
||||||
|
#print "DEBUG: m.groupdict(): %s" % m.groupdict()
|
||||||
|
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
if 'TOURNO' in mg: self.tourNo = mg['TOURNO']
|
if 'TOURNO' in mg: self.tourNo = mg['TOURNO']
|
||||||
if 'LIMIT' in mg: self.gametype['limitType'] = self.limits[mg['LIMIT']]
|
if 'LIMIT' in mg: self.gametype['limitType'] = self.limits[mg['LIMIT']]
|
||||||
if 'GAME' in mg: self.gametype['category'] = self.games[mg['GAME']][1]
|
if 'GAME' in mg: self.gametype['category'] = self.games[mg['GAME']][1]
|
||||||
if 'BUYIN' in mg: self.buyin = int(100*Decimal(mg['BUYIN']))
|
if mg['BUYIN'] != None:
|
||||||
if 'FEE' in mg: self.fee = int(100*Decimal(mg['FEE']))
|
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 'PRIZEPOOL' in mg: self.prizepool = mg['PRIZEPOOL']
|
||||||
if 'ENTRIES' in mg: self.entries = mg['ENTRIES']
|
if 'ENTRIES' in mg: self.entries = mg['ENTRIES']
|
||||||
|
|
||||||
|
@ -217,12 +221,11 @@ class PokerStarsSummary(TourneySummary):
|
||||||
|
|
||||||
|
|
||||||
m = self.re_Currency.search(self.summaryText)
|
m = self.re_Currency.search(self.summaryText)
|
||||||
if m:
|
if m == None:
|
||||||
print "DEBUG: m.groupdict(): %s" % m.groupdict()
|
|
||||||
else:
|
|
||||||
log.error(_("parseSummaryFile: Unable to locate currency"))
|
log.error(_("parseSummaryFile: Unable to locate currency"))
|
||||||
log.error(_("parseSummaryFile: Raising FpdbParseError"))
|
log.error(_("parseSummaryFile: Raising FpdbParseError"))
|
||||||
raise FpdbParseError(_("Unable to locate currency"))
|
raise FpdbParseError(_("Unable to locate currency"))
|
||||||
|
#print "DEBUG: m.groupdict(): %s" % m.groupdict()
|
||||||
|
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
if mg['CURRENCY'] == "$": self.currency = "USD"
|
if mg['CURRENCY'] == "$": self.currency = "USD"
|
||||||
|
@ -232,7 +235,7 @@ class PokerStarsSummary(TourneySummary):
|
||||||
m = self.re_Player.finditer(self.summaryText)
|
m = self.re_Player.finditer(self.summaryText)
|
||||||
for a in m:
|
for a in m:
|
||||||
mg = a.groupdict()
|
mg = a.groupdict()
|
||||||
print "DEBUG: a.groupdict(): %s" % mg
|
#print "DEBUG: a.groupdict(): %s" % mg
|
||||||
name = mg['NAME']
|
name = mg['NAME']
|
||||||
rank = mg['RANK']
|
rank = mg['RANK']
|
||||||
winnings = 0
|
winnings = 0
|
||||||
|
@ -240,15 +243,16 @@ class PokerStarsSummary(TourneySummary):
|
||||||
if 'WINNINGS' in mg and mg['WINNINGS'] != None:
|
if 'WINNINGS' in mg and mg['WINNINGS'] != None:
|
||||||
winnings = int(100*Decimal(mg['WINNINGS']))
|
winnings = int(100*Decimal(mg['WINNINGS']))
|
||||||
|
|
||||||
if 'STILLPLAYING' in mg:
|
if 'STILLPLAYING' in mg and mg['STILLPLAYING'] != None:
|
||||||
#print "stillplaying"
|
#print "stillplaying"
|
||||||
rank=None
|
rank=None
|
||||||
winnings=None
|
winnings=None
|
||||||
|
|
||||||
#TODO: currency, ko/addon/rebuy count -> need examples!
|
#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)
|
self.addPlayer(rank, name, winnings, self.currency, None, None, None)
|
||||||
|
|
||||||
print self
|
#print self
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
#end class PokerStarsSummary
|
#end class PokerStarsSummary
|
||||||
|
|
|
@ -3050,7 +3050,7 @@ class Sql:
|
||||||
# Tourney Results query
|
# Tourney Results query
|
||||||
####################################
|
####################################
|
||||||
self.query['tourneyResults'] = """
|
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
|
FROM TourneysPlayers tp
|
||||||
INNER JOIN Players pl ON (pl.id = tp.playerId)
|
INNER JOIN Players pl ON (pl.id = tp.playerId)
|
||||||
INNER JOIN Tourneys t ON (t.id = tp.tourneyId)
|
INNER JOIN Tourneys t ON (t.id = tp.tourneyId)
|
||||||
|
|
|
@ -74,8 +74,8 @@ class TourneySummary(object):
|
||||||
self.endTime = None
|
self.endTime = None
|
||||||
self.tourNo = None
|
self.tourNo = None
|
||||||
self.currency = None
|
self.currency = None
|
||||||
self.buyin = None
|
self.buyin = 0
|
||||||
self.fee = None
|
self.fee = 0
|
||||||
self.hero = None
|
self.hero = None
|
||||||
self.maxseats = 0
|
self.maxseats = 0
|
||||||
self.entries = 0
|
self.entries = 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user