#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2008-2011, Carl Gherardi # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################## import L10n _ = L10n.get_translation() import logging from HandHistoryConverter import * #import TourneySummary # Fulltilt HH Format converter class Fulltilt(HandHistoryConverter): sitename = "Fulltilt" filetype = "text" 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' : u"\$|\u20AC|\xe2\x82\xac|", # legal currency symbols - Euro(cp1252, utf-8) 'TAB' : u"-\u2013'\s\da-zA-Z#_", # legal characters for tablename 'NUM' : u".,\d", # legal characters in number format } Lim_Blinds = { '0.04': ('0.01', '0.02'), '0.10': ('0.02', '0.05'), '0.20': ('0.05', '0.10'), '0.40': ('0.10', '0.20'), '0.50': ('0.10', '0.25'), '1.00': ('0.25', '0.50'), '1': ('0.25', '0.50'), '2.00': ('0.50', '1.00'), '2': ('0.50', '1.00'), '4.00': ('1.00', '2.00'), '4': ('1.00', '2.00'), '6.00': ('1.00', '3.00'), '6': ('1.00', '3.00'), '8.00': ('2.00', '4.00'), '8': ('2.00', '4.00'), '10.00': ('2.00', '5.00'), '10': ('2.00', '5.00'), '16.00': ('4.00', '8.00'), '16': ('4.00', '8.00'), '20.00': ('5.00', '10.00'), '20': ('5.00', '10.00'), '30.00': ('10.00', '15.00'), '30': ('10.00', '15.00'), '40.00': ('10.00', '20.00'), '40': ('10.00', '20.00'), '60.00': ('15.00', '30.00'), '60': ('15.00', '30.00'), '80.00': ('20.00', '40.00'), '80': ('20.00', '40.00'), '100.00': ('25.00', '50.00'), '100': ('25.00', '50.00'), '200.00': ('50.00', '100.00'), '200': ('50.00', '100.00'), '300.00': ('75.00', '150.00'), '300': ('75.00', '150.00'), '400.00': ('100.00', '200.00'), '400': ('100.00', '200.00'), '500.00': ('125.00', '250.00'), '500': ('125.00', '250.00'), '800.00': ('200.00', '400.00'), '800': ('200.00', '400.00'), '1000.00': ('250.00', '500.00'),'1000': ('250.00', '500.00'), '2000.00': ('500.00', '750.00'),'2000': ('500.00', '1000.00'), '3000.00': ('750.00', '1500.00'),'3000': ('750.00', '1500.00'), } # Static regexes re_GameInfo = re.compile(u'''.*\#(?P[0-9]+):\s (?:(?P.+)\s\((?P\d+)\),\s)? .+ -\s(?P[%(LS)s]|)? (?P[%(NUM)s]+)/ [%(LS)s]?(?P[%(NUM)s]+)\s (Ante\s\$?(?P[%(NUM)s]+)\s)?-\s [%(LS)s]?(?P[%(NUM)s]+\sCap\s)? (?P(No\sLimit|Pot\sLimit|Limit))?\s (?P(Hold\'em|Omaha(\sH/L|\sHi/Lo|\sHi|)|7\sCard\sStud|Stud\sH/L|Razz|Stud\sHi|2-7\sTriple\sDraw|5\sCard\sDraw|Badugi|2-7\sSingle\sDraw)) ''' % substitutions, re.VERBOSE) re_SplitHands = re.compile(r"\n\n\n+") re_TailSplitHands = re.compile(r"(\n\n+)") re_HandInfo = re.compile(u'''.*\#(?P[0-9]+):\s (?:(?P.+)\s\((?P\d+)\),\s)? ((Table|Match)\s)? (?PPlay\sChip\s|PC)? ((?P[%(TAB)s]+)(\s|,)) (?P\sEntry\s\#\d+\s)? (\((?P.+)\)\s)?-\s [%(LS)s]?(?P[%(NUM)s]+)/[%(LS)s]?(?P[%(NUM)s]+)\s(Ante\s[%(LS)s]?(?P[.0-9]+)\s)?-\s [%(LS)s]?(?P[.0-9]+\sCap\s)? (?P[-\da-zA-Z\/\'\s]+)\s-\s (?P.*$) (?P\(partial\))?\s (?:.*?\n(?PHand\s\#(?P=HID)\shas\sbeen\scanceled))? ''' % substitutions, re.MULTILINE|re.VERBOSE) re_TourneyExtraInfo = re.compile('''(((?P[^$]+)? (?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.+)) ''' % substitutions, re.VERBOSE) re_Button = re.compile('^The button is in seat #(?P