From 6a823a430c2acbbfe6d64b929c164bb49556663c Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 26 Aug 2010 10:27:40 +0800 Subject: [PATCH 1/7] Hand: Add PKR to sites lookup --- pyfpdb/Hand.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 0973141f..d90a8d8c 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"): From 159384db17007e776ea5fced27f5b2196e490085 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 26 Aug 2010 10:28:37 +0800 Subject: [PATCH 2/7] PKR: Add a PKR HHC Doesn't actualy work as yet, but the primary regexes are done. --- pyfpdb/PkrToFpdb.py | 394 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 394 insertions(+) create mode 100755 pyfpdb/PkrToFpdb.py diff --git a/pyfpdb/PkrToFpdb.py b/pyfpdb/PkrToFpdb.py new file mode 100755 index 00000000..56697210 --- /dev/null +++ b/pyfpdb/PkrToFpdb.py @@ -0,0 +1,394 @@ +#!/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 + \((%(LS)s)?(?P[.0-9]+)\sin\schips\)""" % 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
[-\ a-zA-Z\d]+)\'\s @@ -97,28 +97,24 @@ class Pkr(HandHistoryConverter): re_DateTime = re.compile("""(?P[0-9]{4})\/(?P[0-9]{2})\/(?P[0-9]{2})[\- ]+(?P[0-9]+):(?P[0-9]+):(?P[0-9]+)""", re.MULTILINE) def compilePlayerRegexs(self, hand): - print "DEBUG: compilePlayerRegexs" players = set([player[1] for player in hand.players]) if not players <= self.compiledPlayers: # x <= y means 'x is subset of y' # we need to recompile the player regexs. -# TODO: should probably rename re_HeroCards and corresponding method, -# since they are used to find all cards on lines starting with "Dealt to:" -# They still identify the hero. self.compiledPlayers = players player_re = "(?P" + "|".join(map(re.escape, players)) + ")" subst = {'PLYR': player_re, 'CUR': self.sym[hand.gametype['currency']]} log.debug("player_re: " + player_re) - self.re_PostSB = re.compile(r"^%(PLYR)s: posts small blind %(CUR)s(?P[.0-9]+)" % subst, re.MULTILINE) - self.re_PostBB = re.compile(r"^%(PLYR)s: posts big blind %(CUR)s(?P[.0-9]+)" % subst, re.MULTILINE) - self.re_Antes = re.compile(r"^%(PLYR)s: posts the ante %(CUR)s(?P[.0-9]+)" % subst, re.MULTILINE) - self.re_BringIn = re.compile(r"^%(PLYR)s: brings[- ]in( low|) for %(CUR)s(?P[.0-9]+)" % subst, re.MULTILINE) - self.re_PostBoth = re.compile(r"^%(PLYR)s: posts small \& big blinds %(CUR)s(?P[.0-9]+)" % subst, re.MULTILINE) - self.re_HeroCards = re.compile(r"^Dealt to %(PLYR)s(?: \[(?P.+?)\])?( \[(?P.+?)\])" % subst, re.MULTILINE) - self.re_Action = re.compile(r""" - ^%(PLYR)s:(?P\sbets|\schecks|\sraises|\scalls|\sfolds|\sdiscards|\sstands\spat) - (\s(%(CUR)s)?(?P[.\d]+))?(\sto\s%(CUR)s(?P[.\d]+))? # the number discarded goes in - (\scards?(\s\[(?P.+?)\])?)?""" - % subst, re.MULTILINE|re.VERBOSE) + self.re_PostSB = re.compile(r"^%(PLYR)s posts small blind %(CUR)s(?P[.0-9]+)" % subst, re.MULTILINE) + # FIXME: Sionel posts $0.04 is a second big blind in a different format. + self.re_PostBB = re.compile(r"^%(PLYR)s posts big blind %(CUR)s(?P[.0-9]+)" % subst, re.MULTILINE) + self.re_Antes = re.compile(r"^%(PLYR)s: posts the ante %(CUR)s(?P[.0-9]+)" % subst, re.MULTILINE) + self.re_BringIn = re.compile(r"^%(PLYR)s: brings[- ]in( low|) for %(CUR)s(?P[.0-9]+)" % subst, re.MULTILINE) + self.re_PostBoth = re.compile(r"^%(PLYR)s: posts small \& big blinds %(CUR)s(?P[.0-9]+)" % subst, re.MULTILINE) + self.re_HeroCards = re.compile(r"^Dealing( \[(?P.+?)\])?( \[(?P.+?)\]) to %(PLYR)s" % subst, re.MULTILINE) + self.re_Action = re.compile(r""" + ^%(PLYR)s(?P\sbets|\schecks|\sraises|\scalls|\sfolds)(\sto)? + (\s(%(CUR)s)?(?P[.\d]+))? + """ % subst, re.MULTILINE|re.VERBOSE) self.re_ShowdownAction = re.compile(r"^%s: shows \[(?P.*)\]" % player_re, re.MULTILINE) self.re_CollectPot = re.compile(r"Seat (?P[0-9]+): %(PLYR)s (\(button\) |\(small blind\) |\(big blind\) |\(button\) \(small blind\) )?(collected|showed \[.*\] and won) \(%(CUR)s(?P[.\d]+)\)(, mucked| with.*|)" % subst, re.MULTILINE) self.re_sitsOut = re.compile("^%s sits out" % player_re, re.MULTILINE) @@ -150,7 +146,7 @@ class Pkr(HandHistoryConverter): raise FpdbParseError(_("Unable to recognise gametype from: '%s'") % tmp) mg = m.groupdict() - print "DEBUG: %s" % mg + #print "DEBUG: %s" % mg if 'LIMIT' in mg: info['limitType'] = self.limits[mg['LIMIT']] @@ -341,7 +337,7 @@ class Pkr(HandHistoryConverter): for action in m: acts = action.groupdict() if action.group('ATYPE') == ' raises': - hand.addRaiseBy( street, action.group('PNAME'), action.group('BET') ) + hand.addRaiseTo( street, action.group('PNAME'), action.group('BET') ) elif action.group('ATYPE') == ' calls': hand.addCall( street, action.group('PNAME'), action.group('BET') ) elif action.group('ATYPE') == ' bets': From 6d2de998c861c8aa2bd132f11e4ec5aff7ebc550 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 27 Aug 2010 00:09:18 +0800 Subject: [PATCH 4/7] FTP: fix type hand.maxSeats to maxseats --- pyfpdb/FulltiltToFpdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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": From 28aaa5366d1895de6fa094e92bd5137e1f62d76b Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 26 Aug 2010 18:17:22 +0200 Subject: [PATCH 5/7] revert recent change of Hand.py to fix FTP --- pyfpdb/Hand.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 0973141f..aa048ae4 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -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 From 93573ac51941efe51375265d07f8a5e0cbd721f6 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 26 Aug 2010 18:19:58 +0200 Subject: [PATCH 6/7] start of german translation --- pyfpdb/locale/fpdb-de_DE.po | 41 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/pyfpdb/locale/fpdb-de_DE.po b/pyfpdb/locale/fpdb-de_DE.po index 38f761df..5952cbbb 100644 --- a/pyfpdb/locale/fpdb-de_DE.po +++ b/pyfpdb/locale/fpdb-de_DE.po @@ -1,20 +1,21 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR ORGANIZATION -# FIRST AUTHOR , YEAR. -# +# Steffen Schaumburg , 2010. msgid "" msgstr "" "Project-Id-Version: 0.20.905 plus git\n" "POT-Creation-Date: 2010-08-25 13:31+CEST\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2010-08-25 18:41+0200\n" "Last-Translator: Steffen Schaumburg \n" -"Language-Team: de_DE \n" +"Language-Team: Fpdb\n" +"Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: UTF-8\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Virtaal 0.6.1\n" "Generated-By: pygettext.py 1.5\n" - #: Anonymise.py:55 msgid "Could not find file %s" msgstr "" @@ -2478,7 +2479,7 @@ msgstr "" #: fpdb.pyw:353 msgid "Database Statistics" -msgstr "" +msgstr "Datenbankstatistiken" #: fpdb.pyw:362 msgid "HUD Configurator - choose category" @@ -2588,39 +2589,40 @@ msgstr "" #: fpdb.pyw:825 msgid "_Main" -msgstr "" +msgstr "_Hauptmenü" #: fpdb.pyw:826 fpdb.pyw:854 msgid "_Quit" -msgstr "" +msgstr "_Beenden" #: fpdb.pyw:827 +#, fuzzy msgid "L" -msgstr "" +msgstr "L" #: fpdb.pyw:827 msgid "_Load Profile (broken)" -msgstr "" +msgstr "Profil _Laden (kaputt)" #: fpdb.pyw:828 msgid "S" -msgstr "" +msgstr "S" #: fpdb.pyw:828 msgid "_Save Profile (todo)" -msgstr "" +msgstr "Profil _Speichern (nicht fertig)" #: fpdb.pyw:829 msgid "F" -msgstr "" +msgstr "F" #: fpdb.pyw:829 msgid "Pre_ferences" -msgstr "" +msgstr "_Einstellungen" #: fpdb.pyw:830 msgid "_Import" -msgstr "" +msgstr "_Importieren" #: fpdb.pyw:831 msgid "_Set HandHistory Archive Directory" @@ -2628,15 +2630,15 @@ msgstr "" #: fpdb.pyw:832 msgid "B" -msgstr "" +msgstr "B" #: fpdb.pyw:833 msgid "I" -msgstr "" +msgstr "I" #: fpdb.pyw:833 msgid "_Import through eMail/IMAP" -msgstr "" +msgstr "_Import per eMail/IMAP" #: fpdb.pyw:834 msgid "_Viewers" @@ -2720,7 +2722,7 @@ msgstr "" #: fpdb.pyw:848 msgid "_Statistics" -msgstr "" +msgstr "_Statistiken" #: fpdb.pyw:849 msgid "Dump Database to Textfile (takes ALOT of time)" @@ -3039,4 +3041,3 @@ msgid "" "\n" "no gtk directories found in your path - install gtk or edit the path manually\n" msgstr "" - From 76f60e3592d51bd049366df9b2e92f78d29097e7 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 26 Aug 2010 18:32:01 +0200 Subject: [PATCH 7/7] include fpdb version in GUI version listing --- pyfpdb/fpdb.pyw | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 9ea632b0..1c1ba4cb 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -264,7 +264,8 @@ class fpdb: , ('numpy', numpy_version) , ('sqlite3', sqlite3_version) , ('sqlite', sqlite_version) - , ('database', self.settings['db-server'] + db_version) + , ('fpdb version', VERSION) + , ('database used', self.settings['db-server']) ] versions = gtk.TextBuffer() w = 20 # width used for module names and version numbers