diff --git a/pyfpdb/AbsoluteToFpdb.py b/pyfpdb/AbsoluteToFpdb.py
index 145a0971..6b57b1e4 100755
--- a/pyfpdb/AbsoluteToFpdb.py
+++ b/pyfpdb/AbsoluteToFpdb.py
@@ -18,23 +18,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
+import L10n
+_ = L10n.get_translation()
+
# TODO: I have no idea if AP has multi-currency options, i just copied the regex out of Everleaf converter for the currency symbols.. weeeeee - Eric
import sys
import logging
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 for converting Absolute HH format.
class Absolute(HandHistoryConverter):
diff --git a/pyfpdb/Anonymise.py b/pyfpdb/Anonymise.py
index 3281fa3f..ffaa6e70 100755
--- a/pyfpdb/Anonymise.py
+++ b/pyfpdb/Anonymise.py
@@ -15,6 +15,9 @@
#along with this program. If not, see .
#In the "official" distribution you can find the license in agpl-3.0.txt.
+import L10n
+_ = L10n.get_translation()
+
import os
import re
import codecs
@@ -23,17 +26,6 @@ import HandHistoryConverter
import Configuration
import sys
-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
(options, argv) = Options.fpdb_options()
config = Configuration.Config()
diff --git a/pyfpdb/BetfairToFpdb.py b/pyfpdb/BetfairToFpdb.py
index a8d510bd..38aa6dc1 100755
--- a/pyfpdb/BetfairToFpdb.py
+++ b/pyfpdb/BetfairToFpdb.py
@@ -18,22 +18,13 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
+import L10n
+_ = L10n.get_translation()
+
import sys
import logging
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
-
# Betfair HH format
class Betfair(HandHistoryConverter):
@@ -115,7 +106,7 @@ class Betfair(HandHistoryConverter):
m = self.re_HandInfo.search(hand.handText)
if(m == None):
log.error(_("Didn't match re_HandInfo"))
- raise FpdbParseError("No match in readHandInfo.")
+ raise FpdbParseError(_("No match in readHandInfo."))
print "DEBUG: got this far!"
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
hand.handid = m.group('HID')
diff --git a/pyfpdb/CarbonToFpdb.py b/pyfpdb/CarbonToFpdb.py
index 4d4e0aa1..cf8794da 100644
--- a/pyfpdb/CarbonToFpdb.py
+++ b/pyfpdb/CarbonToFpdb.py
@@ -19,6 +19,9 @@
########################################################################
+import L10n
+_ = L10n.get_translation()
+
# This code is based heavily on EverleafToFpdb.py, by Carl Gherardi
#
# TODO:
@@ -52,18 +55,6 @@ import logging
from HandHistoryConverter import *
from decimal import Decimal
-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 Carbon(HandHistoryConverter):
@@ -85,8 +76,8 @@ class Carbon(HandHistoryConverter):
# The following are also static regexes: there is no need to call
# compilePlayerRegexes (which does nothing), since players are identified
# not by name but by seat number
- re_PostSB = re.compile(r'', re.MULTILINE)
- re_PostBB = re.compile(r'', re.MULTILINE)
+ re_PostSB = re.compile(r'timestamp="[0-9]+" )?player="(?P[0-9])" amount="(?P[.0-9]+)"/>', re.MULTILINE)
+ re_PostBB = re.compile(r'timestamp="[0-9]+" )?player="(?P[0-9])" amount="(?P[.0-9]+)"/>', re.MULTILINE)
re_PostBoth = re.compile(r'', re.MULTILINE)
#re_Antes = ???
#re_BringIn = ???
@@ -170,7 +161,7 @@ or None if we fail to get the info """
if m is None:
logging.info(_("Didn't match re_HandInfo"))
logging.info(hand.handText)
- return None
+ raise FpdbParseError(_("No match in readHandInfo."))
logging.debug("HID %s-%s, Table %s" % (m.group('HID1'),
m.group('HID2'), m.group('TABLE')[:-1]))
hand.handid = m.group('HID1') + m.group('HID2')
@@ -181,7 +172,7 @@ or None if we fail to get the info """
# Check that the hand is complete up to the awarding of the pot; if
# not, the hand is unparseable
if self.re_EndOfHand.search(hand.handText) is None:
- raise FpdbParseError(hid=m.group('HID1') + "-" + m.group('HID2'))
+ raise FpdbParseError("readHandInfo failed: HID: '%s' HID2: '%s'" %(m.group('HID1'), m.group('HID2')))
def readPlayerStacks(self, hand):
m = self.re_PlayerInfo.finditer(hand.handText)
@@ -221,15 +212,13 @@ or None if we fail to get the info """
pass # ???
def readBlinds(self, hand):
- try:
- m = self.re_PostSB.search(hand.handText)
- hand.addBlind(self.playerNameFromSeatNo(m.group('PSEAT'), hand),
- 'small blind', m.group('SB'))
- except: # no small blind
- hand.addBlind(None, None, None)
+ for a in self.re_PostSB.finditer(hand.handText):
+ #print "DEBUG: found sb: '%s' '%s'" %(self.playerNameFromSeatNo(a.group('PSEAT'), hand), a.group('SB'))
+ hand.addBlind(self.playerNameFromSeatNo(a.group('PSEAT'), hand),'small blind', a.group('SB'))
+
for a in self.re_PostBB.finditer(hand.handText):
- hand.addBlind(self.playerNameFromSeatNo(a.group('PSEAT'), hand),
- 'big blind', a.group('BB'))
+ #print "DEBUG: found bb: '%s' '%s'" %(self.playerNameFromSeatNo(a.group('PSEAT'), hand), a.group('BB'))
+ hand.addBlind(self.playerNameFromSeatNo(a.group('PSEAT'), hand), 'big blind', a.group('BB'))
for a in self.re_PostBoth.finditer(hand.handText):
bb = Decimal(self.info['bb'])
amount = Decimal(a.group('SBBB'))
diff --git a/pyfpdb/Card.py b/pyfpdb/Card.py
index 576a7b38..1a8b12e8 100755
--- a/pyfpdb/Card.py
+++ b/pyfpdb/Card.py
@@ -15,17 +15,8 @@
#along with this program. If not, see .
#In the "official" distribution you can find the license in agpl-3.0.txt.
-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
+import L10n
+_ = L10n.get_translation()
# From fpdb_simple
card_map = { "0": 0, "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8,
@@ -163,6 +154,22 @@ def encodeCard(cardString):
if cardString not in encodeCardList: return 0
return encodeCardList[cardString]
+def encodeRazzStartHand(cards):
+ """No idea how this is actually going to work, figured i'd record the top 10
+ starting hands anyway
+ """
+ pass
+#A, 2, 3
+#A, 2, 4
+#A, 2, 5
+#A, 3, 4
+#2, 3, 4
+#A, 3, 5
+#A, 4, 5
+#2, 3, 5
+#2, 4, 5
+#A, 2, 6
+
if __name__ == '__main__':
print _("fpdb card encoding(same as pokersource)")
for i in xrange(1, 14):
diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py
old mode 100755
new mode 100644
index 91a16cca..20f99893
--- a/pyfpdb/Configuration.py
+++ b/pyfpdb/Configuration.py
@@ -23,6 +23,9 @@ Handles HUD configuration files.
########################################################################
+import L10n
+_ = L10n.get_translation()
+
# Standard Library modules
from __future__ import with_statement
import os
@@ -36,18 +39,6 @@ import re
import xml.dom.minidom
from xml.dom.minidom import Node
-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
-
import logging, logging.config
import ConfigParser
@@ -484,7 +475,7 @@ class Import:
self.callFpdbHud = node.getAttribute("callFpdbHud")
self.hhArchiveBase = node.getAttribute("hhArchiveBase")
self.hhBulkPath = node.getAttribute("hhBulkPath")
- self.saveActions = string_to_bool(node.getAttribute("saveActions"), default=True)
+ self.saveActions = string_to_bool(node.getAttribute("saveActions"), default=False)
self.fastStoreHudCache = string_to_bool(node.getAttribute("fastStoreHudCache"), default=False)
self.saveStarsHH = string_to_bool(node.getAttribute("saveStarsHH"), default=False)
@@ -1263,7 +1254,7 @@ class Config:
except: imp['hhBulkPath'] = ""
try: imp['saveActions'] = self.imp.saveActions
- except: imp['saveActions'] = True
+ except: imp['saveActions'] = False
try: imp['saveStarsHH'] = self.imp.saveStarsHH
except: imp['saveStarsHH'] = False
diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py
index 20480221..870a2743 100644
--- a/pyfpdb/Database.py
+++ b/pyfpdb/Database.py
@@ -20,6 +20,9 @@ Create and manage the database objects.
# 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: - rebuild indexes / vacuum option
@@ -46,18 +49,6 @@ import logging
# logging has been set up in fpdb.py or HUD_main.py, use their settings:
log = logging.getLogger("db")
-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
-
# FreePokerTools modules
import SQL
import Card
diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py
index 1b27c555..22977a26 100755
--- a/pyfpdb/EverleafToFpdb.py
+++ b/pyfpdb/EverleafToFpdb.py
@@ -18,22 +18,13 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
+import L10n
+_ = L10n.get_translation()
+
import sys
import logging
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 for converting Everleaf HH format.
class Everleaf(HandHistoryConverter):
diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py
index 136c0ab6..a4afb24a 100644
--- a/pyfpdb/Filters.py
+++ b/pyfpdb/Filters.py
@@ -15,6 +15,9 @@
#along with this program. If not, see .
#In the "official" distribution you can find the license in agpl-3.0.txt.
+import L10n
+_ = L10n.get_translation()
+
import threading
import pygtk
pygtk.require('2.0')
@@ -30,18 +33,6 @@ import logging
# logging has been set up in fpdb.py or HUD_main.py, use their settings:
log = logging.getLogger("filter")
-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
-
import Configuration
import Database
import SQL
diff --git a/pyfpdb/FullTiltPokerSummary.py b/pyfpdb/FullTiltPokerSummary.py
index 4c141b95..ba8b85cb 100644
--- a/pyfpdb/FullTiltPokerSummary.py
+++ b/pyfpdb/FullTiltPokerSummary.py
@@ -17,6 +17,9 @@
"""pokerstars-specific summary parsing code"""
+import L10n
+_ = L10n.get_translation()
+
from decimal import Decimal
import datetime
@@ -25,18 +28,6 @@ from HandHistoryConverter import *
import PokerStarsToFpdb
from TourneySummary 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 FullTiltPokerSummary(TourneySummary):
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' }
games = { # base, category
diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py
index f94903c5..7c964564 100755
--- a/pyfpdb/FulltiltToFpdb.py
+++ b/pyfpdb/FulltiltToFpdb.py
@@ -18,17 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
-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
+import L10n
+_ = L10n.get_translation()
import logging
from HandHistoryConverter import *
@@ -61,7 +52,7 @@ class Fulltilt(HandHistoryConverter):
(?P(No\sLimit|Pot\sLimit|Limit))?\s
(?P(Hold\'em|Omaha\sHi|Omaha\sH/L|7\sCard\sStud|Stud\sH/L|Razz|Stud\sHi))
''' % substitutions, re.VERBOSE)
- re_SplitHands = re.compile(r"\n\n+")
+ re_SplitHands = re.compile(r"\n\n\n+")
re_TailSplitHands = re.compile(r"(\n\n+)")
re_HandInfo = re.compile(r'''.*\#(?P[0-9]+):\s
(?:(?P.+)\s\((?P\d+)\),\s)?
@@ -186,7 +177,10 @@ class Fulltilt(HandHistoryConverter):
m = self.re_GameInfo.search(handText)
if not m:
- return None
+ tmp = handText[0:100]
+ log.error(_("determineGameType: Unable to recognise gametype from: '%s'") % tmp)
+ log.error(_("determineGameType: Raising FpdbParseError"))
+ raise FpdbParseError(_("Unable to recognise gametype from: '%s'") % tmp)
mg = m.groupdict()
# translations from captured groups to our info strings
@@ -220,7 +214,7 @@ class Fulltilt(HandHistoryConverter):
if m is None:
logging.info(_("Didn't match re_HandInfo"))
logging.info(hand.handText)
- raise FpdbParseError("No match in readHandInfo.")
+ raise FpdbParseError(_("No match in readHandInfo."))
hand.handid = m.group('HID')
hand.tablename = m.group('TABLE')
diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py
index cd374545..5ea0a24b 100755
--- a/pyfpdb/GuiBulkImport.py
+++ b/pyfpdb/GuiBulkImport.py
@@ -15,6 +15,9 @@
#along with this program. If not, see .
#In the "official" distribution you can find the license in agpl-3.0.txt.
+import L10n
+_ = L10n.get_translation()
+
# Standard Library modules
import os
import sys
@@ -33,17 +36,6 @@ import fpdb_import
import Configuration
import Exceptions
-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 GuiBulkImport():
diff --git a/pyfpdb/HUD_config.test.xml b/pyfpdb/HUD_config.test.xml
index 94aefa82..5ec16a56 100644
--- a/pyfpdb/HUD_config.test.xml
+++ b/pyfpdb/HUD_config.test.xml
@@ -2,7 +2,7 @@
-
+