From 246c625fef80dee07128c94dfde5815e07190141 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 5 Aug 2010 16:43:24 +0800 Subject: [PATCH] FTP: Update regexes to support EUR games. This touches on many Full Tilt regexes, and they appear to be functional. I dont have a pristine FTP.fr hand history to test this with yet. Buyer beware. --- pyfpdb/FulltiltToFpdb.py | 61 ++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index cfeb7de1..1ffbc932 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -31,18 +31,23 @@ class Fulltilt(HandHistoryConverter): codepage = ["utf-16", "cp1252", "utf-8"] 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) + } + # Static regexes re_GameInfo = re.compile('''.*\#(?P[0-9]+):\s (?:(?P.+)\s\((?P\d+)\),\s)? .+ - -\s(?P\$|)? + -\s(?P[%(LS)s]|)? (?P[.0-9]+)/ - \$?(?P[.0-9]+)\s + [%(LS)s]?(?P[.0-9]+)\s (Ante\s\$?(?P[.0-9]+)\s)?-\s - \$?(?P[.0-9]+\sCap\s)? + [%(LS)s]?(?P[.0-9]+\sCap\s)? (?P(No\sLimit|Pot\sLimit|Limit))?\s (?P(Hold\'em|Omaha\sHi|Omaha\sH/L|7\sCard\sStud|Stud\sH/L|Razz|Stud\sHi)) - ''', re.VERBOSE) + ''' % substitutions, re.VERBOSE) re_SplitHands = re.compile(r"\n\n+") re_TailSplitHands = re.compile(r"(\n\n+)") re_HandInfo = re.compile(r'''.*\#(?P[0-9]+):\s @@ -51,29 +56,29 @@ class Fulltilt(HandHistoryConverter): (?PPlay\sChip\s|PC)? (?P[-\s\da-zA-Z]+)\s (\((?P.+)\)\s)?-\s - \$?(?P[.0-9]+)/\$?(?P[.0-9]+)\s(Ante\s\$?(?P[.0-9]+)\s)?-\s - \$?(?P[.0-9]+\sCap\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)? (?P[a-zA-Z\/\'\s]+)\s-\s (?P\d+:\d+:\d+\s(?P\w+)\s-\s\d+/\d+/\d+|\d+:\d+\s(?P\w+)\s-\s\w+\,\s\w+\s\d+\,\s\d+) (?P\(partial\))?\n (?:.*?\n(?PHand\s\#(?P=HID)\shas\sbeen\scanceled))? - ''', re.VERBOSE|re.DOTALL) + ''' % substitutions, re.VERBOSE|re.DOTALL) re_TourneyExtraInfo = re.compile('''(((?P[^$]+)? - (?P\$)?(?P[.0-9]+)?\s*\+\s*\$?(?P[.0-9]+)? + (?P[%(LS)s])?(?P[.0-9]+)?\s*\+\s*[%(LS)s]?(?P[.0-9]+)? (\s(?P(KO|Heads\sUp|Matrix\s\dx|Rebuy|Madness)))? (\s(?PShootout))? (\s(?PSit\s&\sGo))? (\s\((?PTurbo)\))?)|(?P.+)) - ''', re.VERBOSE) + ''' % substitutions, re.VERBOSE) re_Button = re.compile('^The button is in seat #(?P