From cefd1e38e4ef5b1d87443ecbca54ec66535cbb3c Mon Sep 17 00:00:00 2001 From: grindi Date: Wed, 5 Aug 2009 20:15:11 +0400 Subject: [PATCH] First "compiling" version --- pyfpdb/Hand.py | 3 +- pyfpdb/PartyPokerToFpdb.py | 510 +++++++++++++++++++++++++++++++++++++ 2 files changed, 512 insertions(+), 1 deletion(-) create mode 100755 pyfpdb/PartyPokerToFpdb.py diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 4d571b76..34ff3b9f 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -40,7 +40,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} + SITEIDS = {'Fulltilt':1, 'PokerStars':2, 'Everleaf':3, 'Win2day':4, 'OnGame':5, 'UltimateBet':6, 'Betfair':7, 'PartyPoker':7} def __init__(self, sitename, gametype, handText, builtFrom = "HHC"): @@ -453,6 +453,7 @@ Add a raise on [street] by [player] to [amountTo] def addCheck(self, street, player): #print "DEBUG: %s %s checked" % (street, player) + logging.debug("%s %s checks" % (street, player)) self.checkPlayerExists(player) self.actions[street].append((player, 'checks')) diff --git a/pyfpdb/PartyPokerToFpdb.py b/pyfpdb/PartyPokerToFpdb.py new file mode 100755 index 00000000..2670531e --- /dev/null +++ b/pyfpdb/PartyPokerToFpdb.py @@ -0,0 +1,510 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright 2008, 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 collections import defaultdict + +from HandHistoryConverter import * + +# PartyPoker HH Format + +class PartyPoker(HandHistoryConverter): + +############################################################ +# Class Variables + + #mixes = { 'HORSE': 'horse', '8-Game': '8game', 'HOSE': 'hose'} # Legal mixed games + sym = {'USD': "\$", } + #sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\x80", "GBP": "\xa3"} # ADD Euro, Sterling, etc HERE + substitutions = { + 'LEGAL_ISO' : "USD|EUR|GBP|CAD", # legal ISO currency codes + 'LS' : "\$|\x80|\xa3" # legal currency symbols ADD Euro, Sterling, etc HERE + } + + # Static regexes + # $5 USD NL Texas Hold'em - Saturday, July 25, 07:53:52 EDT 2009 + # NL Texas Hold'em $1 USD Buy-in Trny:45685440 Level:8 Blinds-Antes(600/1 200 -50) - Sunday, May 17, 11:25:07 MSKS 2009 + re_GameInfoRing = re.compile(""" + (?:\$|)\s*(?P\d+)\s*(?PUSD)?\s* + (?P(NL))\s+ + (?P(Texas\ Hold\'em)) + \s*\-\s* + (?P.+) + """, re.VERBOSE) + re_GameInfoTrny = re.compile(""" + (?P(NL))\s+ + (?P(Texas\ Hold\'em))\s+ + (?:\$|)\s* + (?P[.0-9]+)\s*(?PUSD)?\s*Buy-in\s+ + Trny:\s?(?P\d+)\s+ + Level:\s*(?P\d+)\s+ + Blinds(?:-Antes)?\( + (?P[.0-9 ]+)\s* + /(?P[.0-9 ]+) + (?:\s*-\s*(?P[.0-9 ]+)\$?)? + \) + \s*\-\s* + (?P.+) + """, re.VERBOSE) + re_Hid = re.compile("^Game \#(?P\d+) starts.") + #re_GameInfo = re.compile(""" + #PartyPoker\sGame\s\#(?P[0-9]+):\s+ + #(Tournament\s\# # open paren of tournament info + #(?P\d+),\s + #(?P[%(LS)s\+\d\.]+ # here's how I plan to use LS + #\s?(?P%(LEGAL_ISO)s)? + #)\s)? # close paren of tournament info + #(?PHORSE|8\-Game|HOSE)?\s?\(? + #(?PHold\'em|Razz|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball)\s + #(?PNo\sLimit|Limit|Pot\sLimit)\)?,?\s + #(-\sLevel\s(?P[IVXLC]+)\s)? + #\(? # open paren of the stakes + #(?P%(LS)s|)? + #(?P[.0-9]+)/(%(LS)s)? + #(?P[.0-9]+) + #\s?(?P%(LEGAL_ISO)s)? + #\)\s-\s # close paren of the stakes + #(?P.*$)""" % substitutions, + #re.MULTILINE|re.VERBOSE) + + re_PlayerInfo = re.compile(""" + Seat\s(?P\d+):\s + (?P.*)\s + \(\s*\$?(?P[0-9,.]+)\s*(?:USD)\s*\) + """ , + re.VERBOSE) + #re_PlayerInfo = re.compile(""" + #^Seat\s(?P[0-9]+):\s + #(?P.*)\s + #\((%(LS)s)?(?P[.0-9]+)\sin\schips\)""" % substitutions, + #re.MULTILINE|re.VERBOSE) + + re_HandInfo = re.compile(""" + ^Table\s+ + (?P[a-zA-Z0-9 ]+)\s+ + (?: \#|\(|)(?P\d+)\)?\s+ + (?:[^ ]+\s+\#(?P\d+).+)? # table number for mtt + \((?PReal|Play)\s+Money\)\s+ # FIXME: check if play money is correct + Seat\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