imports still playing tourney's TP, but not winnings of finishers
This commit is contained in:
parent
ae2c32f902
commit
87fbd56091
|
@ -2043,9 +2043,14 @@ class Database:
|
||||||
(hand.tourneyId, playerId, None, None, None, None, None, None))
|
(hand.tourneyId, playerId, None, None, None, None, None, None))
|
||||||
elif source=="TS":
|
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]
|
#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']),
|
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.tourneyId, playerId, int(hand.ranks[player]), int(hand.winnings[player]), hand.winningsCurrency[player],
|
||||||
hand.rebuyCounts[player], hand.addOnCounts[player], hand.koCounts[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))
|
tourneysPlayersIds.append(self.get_last_insert_id(cursor))
|
||||||
return tourneysPlayersIds
|
return tourneysPlayersIds
|
||||||
#end def createOrUpdateTourneysPlayers
|
#end def createOrUpdateTourneysPlayers
|
||||||
|
|
|
@ -28,7 +28,7 @@ class PokerStarsSummary(TourneySummary):
|
||||||
re_TourNo = re.compile("\#[0-9]+,")
|
re_TourNo = re.compile("\#[0-9]+,")
|
||||||
re_Entries = re.compile("[0-9]+")
|
re_Entries = re.compile("[0-9]+")
|
||||||
re_Prizepool = re.compile("\$[0-9]+\.[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_BuyInFee = re.compile("(?P<BUYIN>[0-9]+\.[0-9]+).*(?P<FEE>[0-9]+\.[0-9]+)")
|
||||||
re_FPP = re.compile("(?P<FPP>[0-9]+)\sFPP")
|
re_FPP = re.compile("(?P<FPP>[0-9]+)\sFPP")
|
||||||
#note: the dollar and cent in the below line are currency-agnostic
|
#note: the dollar and cent in the below line are currency-agnostic
|
||||||
|
@ -40,7 +40,7 @@ class PokerStarsSummary(TourneySummary):
|
||||||
lines=self.summaryText.splitlines()
|
lines=self.summaryText.splitlines()
|
||||||
|
|
||||||
self.tourNo = self.re_TourNo.findall(lines[0])[0][1:-1] #ignore game and limit type as thats not recorded
|
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.
|
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"
|
self.currency="USD"
|
||||||
|
@ -66,7 +66,7 @@ class PokerStarsSummary(TourneySummary):
|
||||||
self.entries = self.re_Entries.findall(lines[currentLine])[0]
|
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)
|
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
|
#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])
|
result=self.re_Added.search(lines[currentLine])
|
||||||
if result:
|
if result:
|
||||||
|
@ -75,11 +75,10 @@ class PokerStarsSummary(TourneySummary):
|
||||||
self.addedCurrency=result['CURRENCY']
|
self.addedCurrency=result['CURRENCY']
|
||||||
#print "TODO: implement added:",self.added,self.addedCurrency
|
#print "TODO: implement added:",self.added,self.addedCurrency
|
||||||
currentLine+=1
|
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])
|
result=self.re_Prizepool.findall(lines[currentLine])
|
||||||
if result:
|
if result:
|
||||||
print "prizepool result", result
|
|
||||||
self.prizepool = result[0]
|
self.prizepool = result[0]
|
||||||
self.prizepool = self.prizepool[1:-3]+self.prizepool[-2:]
|
self.prizepool = self.prizepool[1:-3]+self.prizepool[-2:]
|
||||||
currentLine+=1
|
currentLine+=1
|
||||||
|
@ -94,12 +93,14 @@ class PokerStarsSummary(TourneySummary):
|
||||||
|
|
||||||
result=self.re_DateTime.search(lines[currentLine])
|
result=self.re_DateTime.search(lines[currentLine])
|
||||||
if result:
|
if result:
|
||||||
print "endtime result", result
|
|
||||||
result=result.groupdict()
|
result=result.groupdict()
|
||||||
datetimestr = "%s/%s/%s %s:%s:%s" % (result['Y'], result['M'],result['D'],result['H'],result['MIN'],result['S'])
|
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"
|
self.endTime= datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET"
|
||||||
currentLine+=1
|
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
|
for i in range(currentLine,len(lines)-2): #lines with rank and winnings info
|
||||||
if lines[i].find(":")==-1:
|
if lines[i].find(":")==-1:
|
||||||
break
|
break
|
||||||
|
@ -108,11 +109,17 @@ class PokerStarsSummary(TourneySummary):
|
||||||
rank=result['RANK']
|
rank=result['RANK']
|
||||||
name=result['NAME']
|
name=result['NAME']
|
||||||
winnings=result['WINNINGS']
|
winnings=result['WINNINGS']
|
||||||
|
|
||||||
if winnings:
|
if winnings:
|
||||||
winnings=int(100*Decimal(winnings))
|
winnings=int(100*Decimal(winnings))
|
||||||
else:
|
else:
|
||||||
winnings=0
|
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!
|
self.addPlayer(rank, name, winnings, self.currency, None, None, None)#TODO: currency, ko/addon/rebuy count -> need examples!
|
||||||
#end def parseSummary
|
#end def parseSummary
|
||||||
#end class PokerStarsSummary
|
#end class PokerStarsSummary
|
||||||
|
|
|
@ -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))
|
log.debug("addPlayer: rank:%s - name : '%s' - Winnings (%s)" % (rank, name, winnings))
|
||||||
self.players.append(name)
|
self.players.append(name)
|
||||||
|
if rank:
|
||||||
self.ranks.update( { name : Decimal(rank) } )
|
self.ranks.update( { name : Decimal(rank) } )
|
||||||
self.winnings.update( { name : Decimal(winnings) } )
|
self.winnings.update( { name : Decimal(winnings) } )
|
||||||
self.winningsCurrency.update( { name : winningsCurrency } )
|
self.winningsCurrency.update( { name : winningsCurrency } )
|
||||||
|
else:
|
||||||
|
self.ranks.update( { name : None } )
|
||||||
|
self.winnings.update( { name : None } )
|
||||||
|
self.winningsCurrency.update( { name : None } )
|
||||||
if rebuyCount:
|
if rebuyCount:
|
||||||
self.rebuyCounts.update( {name: Decimal(rebuyCount) } )
|
self.rebuyCounts.update( {name: Decimal(rebuyCount) } )
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user