From b6182b419ceeb7d66a34cb7aaf10a81259f57928 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 24 Sep 2010 00:31:17 +0800 Subject: [PATCH] Winamax plugin: Contributed by Forrest --- pyfpdb/WinamaxToFpdb.py | 420 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 420 insertions(+) create mode 100755 pyfpdb/WinamaxToFpdb.py diff --git a/pyfpdb/WinamaxToFpdb.py b/pyfpdb/WinamaxToFpdb.py new file mode 100755 index 00000000..ff644515 --- /dev/null +++ b/pyfpdb/WinamaxToFpdb.py @@ -0,0 +1,420 @@ +#!/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 sys +import exceptions + +import logging +# logging has been set up in fpdb.py or HUD_main.py, use their settings: + +import Configuration +from HandHistoryConverter import * +from decimal import Decimal +import time +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 + +# Winamax HH Format + +class Winamax(HandHistoryConverter): + def Trace(f): + def my_f(*args, **kwds): + print ( "entering " + f.__name__) + result= f(*args, **kwds) + print ( "exiting " + f.__name__) + return result + my_f.__name = f.__name__ + my_f.__doc__ = f.__doc__ + return my_f + + filter = "Winamax" + siteName = "Winamax" + filetype = "text" + codepage = ("utf8", "cp1252") + siteId = 5 # Needs to match id entry in Sites database + + mixes = { } # Legal mixed games + sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\xe2\x82\xac", "GBP": "\xa3"} # 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) + } + + limits = { 'no limit':'nl', 'pot limit' : 'pl','LIMIT':'fl'} + + games = { # base, category + "Holdem" : ('hold','holdem'), + 'Omaha' : ('hold','omahahi'), + # 'Omaha Hi/Lo' : ('hold','omahahilo'), + # 'Razz' : ('stud','razz'), + # 'RAZZ' : ('stud','razz'), + # '7 Card Stud' : ('stud','studhi'), + 'SEVEN_CARD_STUD_HI_LO' : ('stud','studhilo'), + # 'Badugi' : ('draw','badugi'), + # 'Triple Draw 2-7 Lowball' : ('draw','27_3draw'), + # '5 Card Draw' : ('draw','fivedraw') + } + + # Static regexes + # ***** End of hand R5-75443872-57 ***** + re_SplitHands = re.compile(r'\n\n') + + + +# Winamax Poker - CashGame - HandId: #279823-223-1285031451 - Holdem no limit (0.02€/0.05€) - 2010/09/21 03:10:51 UTC + re_HandInfo = re.compile(u""" + \s*Winamax\sPoker\s-\sCashGame\s-\sHandId:\s\#(?P[-A-Z\d]+).*\s + (?PHoldem|Omaha)\s + (?Pno\slimit|pot\slimit)\s + \( + ((%(LS)s)?(?P[.0-9]+)(%(LS)s)?)/ + ((%(LS)s)?(?P[.0-9]+)(%(LS)s)?) + \)\s-\s + (?P.*) + """ % substitutions, re.MULTILINE|re.DOTALL|re.VERBOSE) + + re_TailSplitHands = re.compile(r'\n\s*\n') + re_Button = re.compile(r'Seat\s#(?P