imports still playing tourney's TP, but not winnings of finishers

This commit is contained in:
steffen123 2010-07-11 01:55:15 +02:00
parent ae2c32f902
commit 87fbd56091
3 changed files with 29 additions and 12 deletions

View File

@ -2043,9 +2043,14 @@ class Database:
(hand.tourneyId, playerId, None, None, None, None, None, None))
elif source=="TS":
#print "all values: tourneyId",hand.tourneyId, "playerId",playerId, "rank",hand.ranks[player], "winnings",hand.winnings[player], "winCurr",hand.winningsCurrency[player], hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player]
if hand.ranks[player]:
cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
(hand.tourneyId, playerId, int(hand.ranks[player]), int(hand.winnings[player]), hand.winningsCurrency[player],
hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player]))
else:
cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
(hand.tourneyId, playerId, None, None, None,
hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[player]))
tourneysPlayersIds.append(self.get_last_insert_id(cursor))
return tourneysPlayersIds
#end def createOrUpdateTourneysPlayers

View File

@ -28,7 +28,7 @@ class PokerStarsSummary(TourneySummary):
re_TourNo = re.compile("\#[0-9]+,")
re_Entries = re.compile("[0-9]+")
re_Prizepool = re.compile("\$[0-9]+\.[0-9]+")
re_Player = re.compile("""(?P<RANK>[0-9]+):\s(?P<NAME>.*)\s\(.*\),(\s\$(?P<WINNINGS>[0-9]+\.[0-9]+)\s\()?""")
re_Player = re.compile("""(?P<RANK>[0-9]+):\s(?P<NAME>.*)\s\(.*\),(\s\$(?P<WINNINGS>[0-9]+\.[0-9]+)\s\()?(\s(?P<STILLPLAYING>still\splaying))?""")
re_BuyInFee = re.compile("(?P<BUYIN>[0-9]+\.[0-9]+).*(?P<FEE>[0-9]+\.[0-9]+)")
re_FPP = re.compile("(?P<FPP>[0-9]+)\sFPP")
#note: the dollar and cent in the below line are currency-agnostic
@ -40,7 +40,7 @@ class PokerStarsSummary(TourneySummary):
lines=self.summaryText.splitlines()
self.tourNo = self.re_TourNo.findall(lines[0])[0][1:-1] #ignore game and limit type as thats not recorded
print "tourNo:",self.tourNo
#print "tourNo:",self.tourNo
if lines[1].find("$")!=-1: #TODO: move this into a method and call that from PokerStarsToFpdb.py:269 if hand.buyinCurrency=="USD" etc.
self.currency="USD"
@ -66,7 +66,7 @@ class PokerStarsSummary(TourneySummary):
self.entries = self.re_Entries.findall(lines[currentLine])[0]
currentLine+=1 #note that I chose to make the code keep state (the current line number)
#as that means it'll fail rather than silently skip potentially valuable information
print "after entries lines[currentLine]", lines[currentLine]
#print "after entries lines[currentLine]", lines[currentLine]
result=self.re_Added.search(lines[currentLine])
if result:
@ -75,11 +75,10 @@ class PokerStarsSummary(TourneySummary):
self.addedCurrency=result['CURRENCY']
#print "TODO: implement added:",self.added,self.addedCurrency
currentLine+=1
print "after added/entries lines[currentLine]", lines[currentLine]
#print "after added/entries lines[currentLine]", lines[currentLine]
result=self.re_Prizepool.findall(lines[currentLine])
if result:
print "prizepool result", result
self.prizepool = result[0]
self.prizepool = self.prizepool[1:-3]+self.prizepool[-2:]
currentLine+=1
@ -94,12 +93,14 @@ class PokerStarsSummary(TourneySummary):
result=self.re_DateTime.search(lines[currentLine])
if result:
print "endtime result", result
result=result.groupdict()
datetimestr = "%s/%s/%s %s:%s:%s" % (result['Y'], result['M'],result['D'],result['H'],result['MIN'],result['S'])
self.endTime= datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET"
currentLine+=1
if lines[currentLine].find("Tournament is still in progress")!=-1:
currentLine+=1
for i in range(currentLine,len(lines)-2): #lines with rank and winnings info
if lines[i].find(":")==-1:
break
@ -108,11 +109,17 @@ class PokerStarsSummary(TourneySummary):
rank=result['RANK']
name=result['NAME']
winnings=result['WINNINGS']
if winnings:
winnings=int(100*Decimal(winnings))
else:
winnings=0
if result['STILLPLAYING']:
#print "stillplaying"
rank=None
winnings=None
self.addPlayer(rank, name, winnings, self.currency, None, None, None)#TODO: currency, ko/addon/rebuy count -> need examples!
#end def parseSummary
#end class PokerStarsSummary

View File

@ -230,9 +230,14 @@ winnings (decimal) the money the player ended the tourney with (can be 0, or
"""
log.debug("addPlayer: rank:%s - name : '%s' - Winnings (%s)" % (rank, name, winnings))
self.players.append(name)
if rank:
self.ranks.update( { name : Decimal(rank) } )
self.winnings.update( { name : Decimal(winnings) } )
self.winningsCurrency.update( { name : winningsCurrency } )
else:
self.ranks.update( { name : None } )
self.winnings.update( { name : None } )
self.winningsCurrency.update( { name : None } )
if rebuyCount:
self.rebuyCounts.update( {name: Decimal(rebuyCount) } )
else: