From 3f0f421c0d0435f4978246f97f6ca68357548808 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 18 Aug 2010 13:12:11 +0800 Subject: [PATCH 1/2] FTP: Make FTP.fr hand histories parse. Had to adjust the currency character match, and the tablename which required \u2013 or 'En Dash' Works for the 5 hand sample provided. --- pyfpdb/FulltiltToFpdb.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 179824ac..4d7a7b62 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -32,12 +32,13 @@ class Fulltilt(HandHistoryConverter): siteId = 1 # Needs to match id entry in Sites database substitutions = { - 'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes - 'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8) + 'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes + 'LS' : u"\$|\u20AC|\xe2\x82\xac|", # legal currency symbols - Euro(cp1252, utf-8) + 'TAB' : u"-\u2013\s\da-zA-Z" } # Static regexes - re_GameInfo = re.compile('''.*\#(?P[0-9]+):\s + re_GameInfo = re.compile(u'''.*\#(?P[0-9]+):\s (?:(?P.+)\s\((?P\d+)\),\s)? .+ -\s(?P[%(LS)s]|)? @@ -54,7 +55,7 @@ class Fulltilt(HandHistoryConverter): (?:(?P.+)\s\((?P\d+)\),\s)? (Table|Match)\s (?PPlay\sChip\s|PC)? - (?P[-\s\da-zA-Z]+)\s + (?P
[%(TAB)s]+)\s (\((?P.+)\)\s)?-\s [%(LS)s]?(?P[.0-9]+)/[%(LS)s]?(?P[.0-9]+)\s(Ante\s[%(LS)s]?(?P[.0-9]+)\s)?-\s [%(LS)s]?(?P[.0-9]+\sCap\s)? @@ -168,12 +169,14 @@ class Fulltilt(HandHistoryConverter): # Full Tilt Poker Game #10773265574: Table Butte (6 max) - $0.01/$0.02 - Pot Limit Hold'em - 21:33:46 ET - 2009/02/21 # Full Tilt Poker Game #9403951181: Table CR - tay - $0.05/$0.10 - No Limit Hold'em - 9:40:20 ET - 2008/12/09 # Full Tilt Poker Game #10809877615: Table Danville - $0.50/$1 Ante $0.10 - Limit Razz - 21:47:27 ET - 2009/02/23 + # Full Tilt Poker.fr Game #23057874034: Table Douai–Lens (6 max) - €0.01/€0.02 - No Limit Hold'em - 21:59:17 CET - 2010/08/13 info = {'type':'ring'} m = self.re_GameInfo.search(handText) - if not m: + if not m: return None mg = m.groupdict() + # translations from captured groups to our info strings limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl' } games = { # base, category @@ -205,6 +208,7 @@ class Fulltilt(HandHistoryConverter): if m is None: logging.info("Didn't match re_HandInfo") logging.info(hand.handText) + # Should this throw an exception? - CG return None hand.handid = m.group('HID') hand.tablename = m.group('TABLE') From 8b49f46d1cd5f85831db5583a8cc4bcba68c2bb6 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 18 Aug 2010 13:17:42 +0800 Subject: [PATCH 2/2] HHC: Correct error count for unmatched gametype regex --- pyfpdb/HandHistoryConverter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index eb1d7de8..34619c40 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -272,8 +272,8 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py. l = None if gametype is None: gametype = "unmatched" - # TODO: not ideal, just trying to not error. - # TODO: Need to count failed hands. + # TODO: not ideal, just trying to not error. Throw ParseException? + self.numErrors += 1 else: # See if gametype is supported. type = gametype['type']