From 9329475298546c95993cb7578acb84c09d8a3d47 Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 3 Aug 2010 19:22:52 +0800 Subject: [PATCH] Stars: Take 42 on Tourney parsing Hopefully fix parsing for bounty and cash tourneys for good. FPP is probably still broken --- pyfpdb/PokerStarsToFpdb.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index 1e71c39e..80d48b6b 100644 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -72,7 +72,7 @@ class PokerStars(HandHistoryConverter): (Tournament\s\# # open paren of tournament info (?P\d+),\s # here's how I plan to use LS - (?P(?P[%(LS)s\d\.]+)?\+?(?P[%(LS)s\d\.]+)?\+?(?P[%(LS)s\d\.]+)\s?(?P%(LEGAL_ISO)s)?|Freeroll)\s+)? + (?P(?P[%(LS)s\d\.]+)?\+(?P[%(LS)s\d\.]+)?\+?(?P[%(LS)s\d\.]+)?\s?(?P%(LEGAL_ISO)s)?|Freeroll)\s+)? # close paren of tournament info (?PHORSE|8\-Game|HOSE)?\s?\(? (?PHold\'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 @@ -252,14 +252,20 @@ class PokerStars(HandHistoryConverter): raise FpdbParseError("failed to detect currency") if hand.buyinCurrency!="PSFP": - hand.buyin = int(100*Decimal(info['BIAMT'][1:])) - if info['BIRAKE'][0]!="$": #we have a non-bounty game - info['BOUNTY']=info['BOUNTY']+info['BIRAKE'] #TODO remove this dirty dirty hack by fixing regex - hand.fee = int(100*Decimal(info['BOUNTY'][1:])) - else: - hand.fee = int(100*Decimal(info['BIRAKE'][1:])) - hand.isKO = True - hand.koBounty = int(100*Decimal(info['BOUNTY'][1:])) + if info['BOUNTY'] != None: + # There is a bounty, Which means we need to switch BOUNTY and BIRAKE values + tmp = info['BOUNTY'] + info['BOUNTY'] = info['BIRAKE'] + info['BIRAKE'] = tmp + info['BOUNTY'] = info['BOUNTY'].strip(u'$€') # Strip here where it isn't 'None' + hand.koBounty = int(100*Decimal(info['BOUNTY'])) + + info['BIAMT'] = info['BIAMT'].strip(u'$€') + info['BIRAKE'] = info['BIRAKE'].strip(u'$€') + + hand.buyin = int(100*Decimal(info['BIAMT'])) + hand.fee = int(100*Decimal(info['BIRAKE'])) + hand.isKO = True else: hand.buyin = int(Decimal(info[key][0:-3])) hand.fee = 0