#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2008-2010, 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() # TODO: straighten out discards for draw games import sys from HandHistoryConverter import * from decimal_wrapper import Decimal # PacificPoker HH Format class PacificPoker(HandHistoryConverter): # Class Variables sitename = "PacificPoker" filetype = "text" codepage = ("utf8", "cp1252") siteId = 13 # Needs to match id entry in Sites database mixes = { 'HORSE': 'horse', '8-Game': '8game', 'HOSE': 'hose'} # Legal mixed games sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\xe2\x82\xac", "GBP": "\xa3", "play": ""} # ADD Euro, Sterling, etc HERE substitutions = { 'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes 'LS' : u"\$|\xe2\x82\xac|\u20ac|" # legal currency symbols - Euro(cp1252, utf-8) } # translations from captured groups to fpdb info strings # :: TODO 0.02 limit does not seem right Lim_Blinds = { '0.02': ('0.01', '0.02'), '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'), '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'), '400.00': ('100.00', '200.00'), '400': ('100.00', '200.00'), '800.00': ('200.00', '400.00'), '800': ('200.00', '400.00'), '1000.00': ('250.00', '500.00'),'1000': ('250.00', '500.00') } limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl', 'Fix Limit':'fl' } games = { # base, category "Holdem" : ('hold','holdem'), 'Omaha' : ('hold','omahahi'), 'Omaha Hi/Lo' : ('hold','omahahilo'), 'OmahaHL' : ('hold','omahahilo'), 'Razz' : ('stud','razz'), 'RAZZ' : ('stud','razz'), '7 Card Stud' : ('stud','studhi'), '7 Card Stud Hi/Lo' : ('stud','studhilo'), 'Badugi' : ('draw','badugi'), 'Triple Draw 2-7 Lowball' : ('draw','27_3draw'), 'Single Draw 2-7 Lowball' : ('draw','27_1draw'), '5 Card Draw' : ('draw','fivedraw') } currencies = { u'€':'EUR', '$':'USD', '':'T$' } # Static regexes re_GameInfo = re.compile(u""" \#Game\sNo\s:\s(?P[0-9]+)\\n \*\*\*\*\*\sCassava\sHand\sHistory\sfor\sGame\s[0-9]+\s\*\*\*\*\*\\n (?P%(LS)s)?(?P[.,0-9]+)/(%(LS)s)?(?P[.,0-9]+)\sBlinds\s (?PNo\sLimit|Fix\sLimit|Pot\sLimit)\s (?PHoldem|Omaha|OmahaHL) \s-\s\*\*\*\s (?P.*$) """ % substitutions, re.MULTILINE|re.VERBOSE) re_PlayerInfo = re.compile(u""" ^Seat\s(?P[0-9]+):\s (?P.*)\s \(\s(%(LS)s)?(?P[.,0-9]+)\s\)""" % substitutions, re.MULTILINE|re.VERBOSE) re_HandInfo = re.compile(""" ^Table\s(?P[-\ \#a-zA-Z\d]+)\s (\(Real\sMoney\))? (?P\(Practice\sPlay\))? \\n Seat\s(?P