From 961ade9aff947afd50bf4d213cc4c991b2205713 Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 31 Jul 2010 16:57:25 +0800 Subject: [PATCH 1/7] Stars: Make Knockout tourneys parse Adjusted GameInfo regex to separately parse buyin, rake and knockout for tournamets --- pyfpdb/PokerStarsToFpdb.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index 0a9e47fc..a45a9b4e 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([%(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 @@ -206,24 +206,20 @@ class PokerStars(HandHistoryConverter): m = self.re_HandInfo.search(hand.handText,re.DOTALL) if m: info.update(m.groupdict()) -# hand.maxseats = int(m2.group(1)) else: pass # throw an exception here, eh? m = self.re_GameInfo.search(hand.handText) if m: info.update(m.groupdict()) -# m = self.re_Button.search(hand.handText) -# if m: info.update(m.groupdict()) - # TODO : I rather like the idea of just having this dict as hand.info + log.debug("readHandInfo: %s" % info) for key in info: if key == 'DATETIME': - #2008/11/12 10:00:48 CET [2008/11/12 4:00:48 ET] # (both dates are parsed so ET date overrides the other) + #2008/11/12 10:00:48 CET [2008/11/12 4:00:48 ET] # (both dates are parsed so ET date overrides the other) #2008/08/17 - 01:14:43 (ET) #2008/09/07 06:23:14 ET m1 = self.re_DateTime.finditer(info[key]) - # m2 = re.search("(?P[0-9]{4})\/(?P[0-9]{2})\/(?P[0-9]{2})[\- ]+(?P[0-9]+):(?P[0-9]+):(?P[0-9]+)", info[key]) - datetimestr = "2000/01/01 00:00:00" # default used if time not found (stops import crashing, but startTime will be wrong) + datetimestr = "2000/01/01 00:00:00" # default used if time not found for a in m1: datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'), a.group('M'),a.group('D'),a.group('H'),a.group('MIN'),a.group('S')) #tz = a.group('TZ') # just assume ET?? @@ -236,12 +232,15 @@ class PokerStars(HandHistoryConverter): hand.tourNo = info[key] if key == 'BUYIN': if hand.tourNo!=None: + #print "DEBUG: info['BUYIN']: %s" % info['BUYIN'] + #print "DEBUG: info['BIAMT']: %s" % info['BIAMT'] + #print "DEBUG: info['BIRAKE']: %s" % info['BIRAKE'] + #print "DEBUG: info['BOUNTY']: %s" % info['BOUNTY'] if info[key] == 'Freeroll': hand.buyin = 0 hand.fee = 0 hand.buyinCurrency = "FREE" else: - #print "info[key]:",info[key] if info[key].find("$")!=-1: hand.buyinCurrency="USD" elif info[key].find(u"€")!=-1: @@ -249,13 +248,13 @@ class PokerStars(HandHistoryConverter): elif info[key].find("FPP")!=-1: hand.buyinCurrency="PSFP" else: - raise FpdbParseError("failed to detect currency") #FIXME: handle other currencies, FPP, play money + #FIXME: handle other currencies, FPP, play money + raise FpdbParseError("failed to detect currency") if hand.buyinCurrency=="USD" or hand.buyinCurrency=="EUR": - info[key]=info[key][:-4] - middle=info[key].find("+") - hand.buyin = int(100*Decimal(info[key][1:middle])) - hand.fee = int(100*Decimal(info[key][middle+2:])) + hand.buyin = int(100*Decimal(info['BIAMT'][1:])) + hand.fee = int(100*Decimal(info['BIRAKE'][1:])) + # TODO: Bounty is in key 'BOUNTY' elif hand.buyinCurrency=="PSFP": hand.buyin = int(Decimal(info[key][0:-3])) hand.fee = 0 From 223f7441b6254c4b7da107ad7ad6f4ba37fe81ad Mon Sep 17 00:00:00 2001 From: grindi Date: Sat, 31 Jul 2010 14:38:24 +0400 Subject: [PATCH 2/7] Fixes for absolute poker Note: previous xtables's re doesn't match java absolute client --- pyfpdb/AbsoluteToFpdb.py | 32 ++++++++++++++++++-------------- pyfpdb/XTables.py | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/pyfpdb/AbsoluteToFpdb.py b/pyfpdb/AbsoluteToFpdb.py index 26aea7e8..31e21764 100755 --- a/pyfpdb/AbsoluteToFpdb.py +++ b/pyfpdb/AbsoluteToFpdb.py @@ -42,10 +42,10 @@ class Absolute(HandHistoryConverter): #Seat 6 - FETS63 ($0.75 in chips) #Board [10s 5d Kh Qh 8c] - re_GameInfo = re.compile(ur"^Stage #([0-9]+): (?PHoldem|HORSE)(?: \(1 on 1\)|)? ?(?PNo Limit|Pot Limit|Normal|)? ?(?P\$| €|)(?P[.0-9]+)/?(?:\$| €|)(?P[.0-9]+)?", re.MULTILINE) + re_GameInfo = re.compile(ur"^Stage #(C?[0-9]+): (?PHoldem|HORSE)(?: \(1 on 1\)|)? ?(?PNo Limit|Pot Limit|Normal|)? ?(?P\$| €|)(?P[.0-9]+)/?(?:\$| €|)(?P[.0-9]+)?", re.MULTILINE) re_HorseGameInfo = re.compile(ur"^Game Type: (?PLimit) (?PHoldem)", re.MULTILINE) # TODO: can set max seats via (1 on 1) to a known 2 .. - re_HandInfo = re.compile(ur"^Stage #(?P[0-9]+): .*(?P\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d).*\n(Table: (?P.*) \(Real Money\))?", re.MULTILINE) + re_HandInfo = re.compile(ur"^Stage #C?(?P[0-9]+): .*(?P\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d).*\n(Table: (?P
.*) \(Real Money\))?", re.MULTILINE) re_TableFromFilename = re.compile(ur".*IHH([0-9]+) (?P
.*) -") # on HORSE STUD games, the table name isn't in the hand info! re_Button = re.compile(ur"Seat #(?P