#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 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 sys from HandHistoryConverter import * import locale lang=locale.getdefaultlocale()[0][0:2] if lang=="en": def _(string): return string else: import gettext try: trans = gettext.translation("fpdb", localedir="locale", languages=[lang]) trans.install() except IOError: def _(string): return string class Pkr(HandHistoryConverter): # Class Variables sitename = "PKR" filetype = "text" codepage = ("utf8", "cp1252") siteId = 12 # Needs to match id entry in Sites database mixes = { 'HORSE': 'horse', '8-Game': '8game', 'HOSE': 'hose'} # Legal mixed games sym = {'USD': "\$"} # ADD Euro, Sterling, etc HERE substitutions = { 'LEGAL_ISO' : "USD", # legal ISO currency codes 'LS' : "\$|" # legal currency symbols - Euro(cp1252, utf-8) } limits = { 'NO LIMIT':'nl', 'POT LIMIT':'pl', 'LIMIT':'fl' } games = { # base, category "HOLD'EM" : ('hold','holdem'), 'FIXMEOmaha' : ('hold','omahahi'), 'FIXMEOmaha Hi/Lo' : ('hold','omahahilo'), 'FIXME5 Card Draw' : ('draw','fivedraw') } currencies = { u'€':'EUR', '$':'USD', '':'T$' } # Static regexes re_GameInfo = re.compile(u""" Table\s\#\d+\s\-\s(?P[a-zA-Z\ \d]+)\s Starting\sHand\s\#(?P[0-9]+)\s Start\stime\sof\shand:\s(?P.*)\s Last\sHand\s\#[0-9]+\s Game\sType:\s(?PHOLD'EM|5\sCard\sDraw)\s Limit\sType:\s(?PNO\sLIMIT|LIMIT|POT\sLIMIT)\s Table\sType\:\sRING\s Money\sType:\sREAL\sMONEY\s Blinds\sare\snow\s(?P%(LS)s|)? (?P[.0-9]+)/(%(LS)s)? (?P[.0-9]+) """ % substitutions, re.MULTILINE|re.VERBOSE) re_PlayerInfo = re.compile(u""" ^Seat\s(?P[0-9]+):\s (?P.*)\s-\s (%(LS)s)?(?P[.0-9]+) """ % substitutions, re.MULTILINE|re.VERBOSE) re_HandInfo = re.compile(""" ^Table\s\'(?P
[-\ a-zA-Z\d]+)\'\s ((?P\d+)-max\s)? (?P\(Play\sMoney\)\s)? (Seat\s\#(?P
[ a-zA-Z]+) - \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P.*) - (?P
[0-9]+):(?P[0-9]+) ET - (?P[0-9]+)/(?P[0-9]+)/(?P[0-9]+)Table (?P
[ a-zA-Z]+)\nSeat (?P