diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index a3526ca0..4b5fbcfd 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -261,7 +261,7 @@ class Fulltilt(HandHistoryConverter): if special == "KO": hand.isKO = True if special == "Head's Up" or special == "Heads Up": - hand.maxSeats = 2 + hand.maxseats = 2 if re.search("Matrix", special): hand.isMatrix = True if special == "Shootout": diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 0973141f..d9c7c07a 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -58,7 +58,7 @@ class Hand(object): LCS = {'H':'h', 'D':'d', 'C':'c', 'S':'s'} SYMBOL = {'USD': '$', 'EUR': u'$', 'T$': '', 'play': ''} MS = {'horse' : 'HORSE', '8game' : '8-Game', 'hose' : 'HOSE', 'ha': 'HA'} - SITEIDS = {'Fulltilt':1, 'PokerStars':2, 'Everleaf':3, 'Win2day':4, 'OnGame':5, 'UltimateBet':6, 'Betfair':7, 'Absolute':8, 'PartyPoker':9, 'Partouche':10, 'Carbon':11 } + SITEIDS = {'Fulltilt':1, 'PokerStars':2, 'Everleaf':3, 'Win2day':4, 'OnGame':5, 'UltimateBet':6, 'Betfair':7, 'Absolute':8, 'PartyPoker':9, 'Partouche':10, 'Carbon':11, 'PKR':12 } def __init__(self, config, sitename, gametype, handText, builtFrom = "HHC"): @@ -77,7 +77,7 @@ class Hand(object): self.dbid_gt = 0 self.tablename = "" self.hero = "" - self.maxseats = 0 + self.maxseats = None self.counted_seats = 0 self.buttonpos = 0 diff --git a/pyfpdb/PkrToFpdb.py b/pyfpdb/PkrToFpdb.py new file mode 100755 index 00000000..a94cd030 --- /dev/null +++ b/pyfpdb/PkrToFpdb.py @@ -0,0 +1,390 @@ +#!/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