From f61fcc4b4aace5c81c266a6600202a856162a4ad Mon Sep 17 00:00:00 2001 From: Robert Wielinga Date: Sat, 12 Mar 2011 13:28:55 +0100 Subject: [PATCH 1/7] Added the PacifikPoker (888Poker) HandHistoryConverter --- pyfpdb/PacificPokerToFpdb.py | 467 +++++++++++++++++++++++++++++++++++ 1 file changed, 467 insertions(+) create mode 100644 pyfpdb/PacificPokerToFpdb.py diff --git a/pyfpdb/PacificPokerToFpdb.py b/pyfpdb/PacificPokerToFpdb.py new file mode 100644 index 00000000..34fb2265 --- /dev/null +++ b/pyfpdb/PacificPokerToFpdb.py @@ -0,0 +1,467 @@ +#!/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' : "\$|\xe2\x82\xac|" # 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(?PFrom 43b071515d05aaf4338e8fae5be7de8c9600813f Mon Sep 17 00:00:00 2001 From: Steffen Schaumburg Date: Sat, 19 Mar 2011 20:15:53 +0100 Subject: [PATCH 6/7] remove hharchivebase from code and test config --- pyfpdb/Configuration.py | 12 ++---------- pyfpdb/HUD_config.test.xml | 2 +- pyfpdb/HandHistoryConverter.py | 16 ---------------- pyfpdb/fpdb.pyw | 20 -------------------- pyfpdb/fpdb_import.py | 11 +---------- 5 files changed, 4 insertions(+), 57 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 4d468405..c1b3e16a 100644 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -485,7 +485,6 @@ class Import: self.node = node self.interval = node.getAttribute("interval") self.callFpdbHud = node.getAttribute("callFpdbHud") - self.hhArchiveBase = node.getAttribute("hhArchiveBase") self.ResultsDirectory = node.getAttribute("ResultsDirectory") self.hhBulkPath = node.getAttribute("hhBulkPath") self.saveActions = string_to_bool(node.getAttribute("saveActions"), default=False) @@ -495,8 +494,8 @@ class Import: self.saveStarsHH = string_to_bool(node.getAttribute("saveStarsHH"), default=False) def __str__(self): - return " interval = %s\n callFpdbHud = %s\n hhArchiveBase = %s\n saveActions = %s\n fastStoreHudCache = %s\nResultsDirectory = %s" \ - % (self.interval, self.callFpdbHud, self.hhArchiveBase, self.saveActions, self.cacheSessions, self.sessionTimeout, self.fastStoreHudCache, self.ResultsDirectory) + return " interval = %s\n callFpdbHud = %s\n saveActions = %s\n fastStoreHudCache = %s\nResultsDirectory = %s" \ + % (self.interval, self.callFpdbHud, self.saveActions, self.cacheSessions, self.sessionTimeout, self.fastStoreHudCache, self.ResultsDirectory) class HudUI: def __init__(self, node): @@ -861,9 +860,6 @@ class Config: return nodes_added - def set_hhArchiveBase(self, path): - self.imp.node.setAttribute("hhArchiveBase", path) - def find_default_conf(self): if os.name == 'posix': config_path = os.path.join(os.path.expanduser("~"), '.fpdb', 'default.conf') @@ -1261,10 +1257,6 @@ class Config: try: imp['interval'] = self.imp.interval except: imp['interval'] = 10 - # hhArchiveBase is the temp store for part-processed hand histories - should be redundant eventually - try: imp['hhArchiveBase'] = self.imp.hhArchiveBase - except: imp['hhArchiveBase'] = "~/.fpdb/HandHistories/" - # ResultsDirectory is the local cache for downloaded results # NOTE: try: except: doesn'tseem to be triggering # using if instead diff --git a/pyfpdb/HUD_config.test.xml b/pyfpdb/HUD_config.test.xml index dca95cd1..fba76fe1 100644 --- a/pyfpdb/HUD_config.test.xml +++ b/pyfpdb/HUD_config.test.xml @@ -2,7 +2,7 @@ - +