Merge branch 'master' of git://git.assembla.com/fpdboz
This commit is contained in:
commit
1dedbe2a45
|
@ -18,23 +18,14 @@
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# 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
|
# 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 sys
|
||||||
import logging
|
import logging
|
||||||
from HandHistoryConverter import *
|
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 for converting Absolute HH format.
|
||||||
|
|
||||||
class Absolute(HandHistoryConverter):
|
class Absolute(HandHistoryConverter):
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import codecs
|
import codecs
|
||||||
|
@ -23,17 +26,6 @@ import HandHistoryConverter
|
||||||
import Configuration
|
import Configuration
|
||||||
import sys
|
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()
|
(options, argv) = Options.fpdb_options()
|
||||||
config = Configuration.Config()
|
config = Configuration.Config()
|
||||||
|
|
|
@ -18,22 +18,13 @@
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
from HandHistoryConverter import *
|
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
|
# Betfair HH format
|
||||||
|
|
||||||
class Betfair(HandHistoryConverter):
|
class Betfair(HandHistoryConverter):
|
||||||
|
@ -115,7 +106,7 @@ class Betfair(HandHistoryConverter):
|
||||||
m = self.re_HandInfo.search(hand.handText)
|
m = self.re_HandInfo.search(hand.handText)
|
||||||
if(m == None):
|
if(m == None):
|
||||||
log.error(_("Didn't match re_HandInfo"))
|
log.error(_("Didn't match re_HandInfo"))
|
||||||
raise FpdbParseError("No match in readHandInfo.")
|
raise FpdbParseError(_("No match in readHandInfo."))
|
||||||
print "DEBUG: got this far!"
|
print "DEBUG: got this far!"
|
||||||
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
|
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
|
||||||
hand.handid = m.group('HID')
|
hand.handid = m.group('HID')
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
# This code is based heavily on EverleafToFpdb.py, by Carl Gherardi
|
# This code is based heavily on EverleafToFpdb.py, by Carl Gherardi
|
||||||
#
|
#
|
||||||
# TODO:
|
# TODO:
|
||||||
|
@ -52,18 +55,6 @@ import logging
|
||||||
from HandHistoryConverter import *
|
from HandHistoryConverter import *
|
||||||
from decimal import Decimal
|
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):
|
class Carbon(HandHistoryConverter):
|
||||||
|
|
||||||
|
@ -85,8 +76,8 @@ class Carbon(HandHistoryConverter):
|
||||||
# The following are also static regexes: there is no need to call
|
# The following are also static regexes: there is no need to call
|
||||||
# compilePlayerRegexes (which does nothing), since players are identified
|
# compilePlayerRegexes (which does nothing), since players are identified
|
||||||
# not by name but by seat number
|
# not by name but by seat number
|
||||||
re_PostSB = re.compile(r'<event sequence="[0-9]+" type="(SMALL_BLIND|RETURN_BLIND)" player="(?P<PSEAT>[0-9])" amount="(?P<SB>[.0-9]+)"/>', re.MULTILINE)
|
re_PostSB = re.compile(r'<event sequence="[0-9]+" type="(SMALL_BLIND|RETURN_BLIND)" (?P<TIMESTAMP>timestamp="[0-9]+" )?player="(?P<PSEAT>[0-9])" amount="(?P<SB>[.0-9]+)"/>', re.MULTILINE)
|
||||||
re_PostBB = re.compile(r'<event sequence="[0-9]+" type="(BIG_BLIND|INITIAL_BLIND)" player="(?P<PSEAT>[0-9])" amount="(?P<BB>[.0-9]+)"/>', re.MULTILINE)
|
re_PostBB = re.compile(r'<event sequence="[0-9]+" type="(BIG_BLIND|INITIAL_BLIND)" (?P<TIMESTAMP>timestamp="[0-9]+" )?player="(?P<PSEAT>[0-9])" amount="(?P<BB>[.0-9]+)"/>', re.MULTILINE)
|
||||||
re_PostBoth = re.compile(r'<event sequence="[0-9]+" type="(RETURN_BLIND)" player="(?P<PSEAT>[0-9])" amount="(?P<SBBB>[.0-9]+)"/>', re.MULTILINE)
|
re_PostBoth = re.compile(r'<event sequence="[0-9]+" type="(RETURN_BLIND)" player="(?P<PSEAT>[0-9])" amount="(?P<SBBB>[.0-9]+)"/>', re.MULTILINE)
|
||||||
#re_Antes = ???
|
#re_Antes = ???
|
||||||
#re_BringIn = ???
|
#re_BringIn = ???
|
||||||
|
@ -170,7 +161,7 @@ or None if we fail to get the info """
|
||||||
if m is None:
|
if m is None:
|
||||||
logging.info(_("Didn't match re_HandInfo"))
|
logging.info(_("Didn't match re_HandInfo"))
|
||||||
logging.info(hand.handText)
|
logging.info(hand.handText)
|
||||||
return None
|
raise FpdbParseError(_("No match in readHandInfo."))
|
||||||
logging.debug("HID %s-%s, Table %s" % (m.group('HID1'),
|
logging.debug("HID %s-%s, Table %s" % (m.group('HID1'),
|
||||||
m.group('HID2'), m.group('TABLE')[:-1]))
|
m.group('HID2'), m.group('TABLE')[:-1]))
|
||||||
hand.handid = m.group('HID1') + m.group('HID2')
|
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
|
# Check that the hand is complete up to the awarding of the pot; if
|
||||||
# not, the hand is unparseable
|
# not, the hand is unparseable
|
||||||
if self.re_EndOfHand.search(hand.handText) is None:
|
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):
|
def readPlayerStacks(self, hand):
|
||||||
m = self.re_PlayerInfo.finditer(hand.handText)
|
m = self.re_PlayerInfo.finditer(hand.handText)
|
||||||
|
@ -221,15 +212,13 @@ or None if we fail to get the info """
|
||||||
pass # ???
|
pass # ???
|
||||||
|
|
||||||
def readBlinds(self, hand):
|
def readBlinds(self, hand):
|
||||||
try:
|
for a in self.re_PostSB.finditer(hand.handText):
|
||||||
m = self.re_PostSB.search(hand.handText)
|
#print "DEBUG: found sb: '%s' '%s'" %(self.playerNameFromSeatNo(a.group('PSEAT'), hand), a.group('SB'))
|
||||||
hand.addBlind(self.playerNameFromSeatNo(m.group('PSEAT'), hand),
|
hand.addBlind(self.playerNameFromSeatNo(a.group('PSEAT'), hand),'small blind', a.group('SB'))
|
||||||
'small blind', m.group('SB'))
|
|
||||||
except: # no small blind
|
|
||||||
hand.addBlind(None, None, None)
|
|
||||||
for a in self.re_PostBB.finditer(hand.handText):
|
for a in self.re_PostBB.finditer(hand.handText):
|
||||||
hand.addBlind(self.playerNameFromSeatNo(a.group('PSEAT'), hand),
|
#print "DEBUG: found bb: '%s' '%s'" %(self.playerNameFromSeatNo(a.group('PSEAT'), hand), a.group('BB'))
|
||||||
'big blind', 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):
|
for a in self.re_PostBoth.finditer(hand.handText):
|
||||||
bb = Decimal(self.info['bb'])
|
bb = Decimal(self.info['bb'])
|
||||||
amount = Decimal(a.group('SBBB'))
|
amount = Decimal(a.group('SBBB'))
|
||||||
|
|
|
@ -15,17 +15,8 @@
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
import locale
|
import L10n
|
||||||
lang=locale.getdefaultlocale()[0][0:2]
|
_ = L10n.get_translation()
|
||||||
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
|
|
||||||
|
|
||||||
# From fpdb_simple
|
# From fpdb_simple
|
||||||
card_map = { "0": 0, "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8,
|
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
|
if cardString not in encodeCardList: return 0
|
||||||
return encodeCardList[cardString]
|
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__':
|
if __name__ == '__main__':
|
||||||
print _("fpdb card encoding(same as pokersource)")
|
print _("fpdb card encoding(same as pokersource)")
|
||||||
for i in xrange(1, 14):
|
for i in xrange(1, 14):
|
||||||
|
|
19
pyfpdb/Configuration.py
Executable file → Normal file
19
pyfpdb/Configuration.py
Executable file → Normal file
|
@ -23,6 +23,9 @@ Handles HUD configuration files.
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
# Standard Library modules
|
# Standard Library modules
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
import os
|
import os
|
||||||
|
@ -36,18 +39,6 @@ import re
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
from xml.dom.minidom import Node
|
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 logging, logging.config
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
|
||||||
|
@ -484,7 +475,7 @@ class Import:
|
||||||
self.callFpdbHud = node.getAttribute("callFpdbHud")
|
self.callFpdbHud = node.getAttribute("callFpdbHud")
|
||||||
self.hhArchiveBase = node.getAttribute("hhArchiveBase")
|
self.hhArchiveBase = node.getAttribute("hhArchiveBase")
|
||||||
self.hhBulkPath = node.getAttribute("hhBulkPath")
|
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.fastStoreHudCache = string_to_bool(node.getAttribute("fastStoreHudCache"), default=False)
|
||||||
self.saveStarsHH = string_to_bool(node.getAttribute("saveStarsHH"), default=False)
|
self.saveStarsHH = string_to_bool(node.getAttribute("saveStarsHH"), default=False)
|
||||||
|
|
||||||
|
@ -1263,7 +1254,7 @@ class Config:
|
||||||
except: imp['hhBulkPath'] = ""
|
except: imp['hhBulkPath'] = ""
|
||||||
|
|
||||||
try: imp['saveActions'] = self.imp.saveActions
|
try: imp['saveActions'] = self.imp.saveActions
|
||||||
except: imp['saveActions'] = True
|
except: imp['saveActions'] = False
|
||||||
|
|
||||||
try: imp['saveStarsHH'] = self.imp.saveStarsHH
|
try: imp['saveStarsHH'] = self.imp.saveStarsHH
|
||||||
except: imp['saveStarsHH'] = False
|
except: imp['saveStarsHH'] = False
|
||||||
|
|
|
@ -20,6 +20,9 @@ Create and manage the database objects.
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
# TODO: - rebuild indexes / vacuum option
|
# 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:
|
# logging has been set up in fpdb.py or HUD_main.py, use their settings:
|
||||||
log = logging.getLogger("db")
|
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
|
# FreePokerTools modules
|
||||||
import SQL
|
import SQL
|
||||||
import Card
|
import Card
|
||||||
|
|
|
@ -18,22 +18,13 @@
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
from HandHistoryConverter import *
|
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 for converting Everleaf HH format.
|
||||||
|
|
||||||
class Everleaf(HandHistoryConverter):
|
class Everleaf(HandHistoryConverter):
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
import pygtk
|
import pygtk
|
||||||
pygtk.require('2.0')
|
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:
|
# logging has been set up in fpdb.py or HUD_main.py, use their settings:
|
||||||
log = logging.getLogger("filter")
|
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 Configuration
|
||||||
import Database
|
import Database
|
||||||
import SQL
|
import SQL
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
|
|
||||||
"""pokerstars-specific summary parsing code"""
|
"""pokerstars-specific summary parsing code"""
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
@ -25,18 +28,6 @@ from HandHistoryConverter import *
|
||||||
import PokerStarsToFpdb
|
import PokerStarsToFpdb
|
||||||
from TourneySummary import *
|
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):
|
class FullTiltPokerSummary(TourneySummary):
|
||||||
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' }
|
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' }
|
||||||
games = { # base, category
|
games = { # base, category
|
||||||
|
|
|
@ -18,17 +18,8 @@
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
import locale
|
import L10n
|
||||||
lang=locale.getdefaultlocale()[0][0:2]
|
_ = L10n.get_translation()
|
||||||
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
|
import logging
|
||||||
from HandHistoryConverter import *
|
from HandHistoryConverter import *
|
||||||
|
@ -61,7 +52,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
(?P<LIMIT>(No\sLimit|Pot\sLimit|Limit))?\s
|
(?P<LIMIT>(No\sLimit|Pot\sLimit|Limit))?\s
|
||||||
(?P<GAME>(Hold\'em|Omaha\sHi|Omaha\sH/L|7\sCard\sStud|Stud\sH/L|Razz|Stud\sHi))
|
(?P<GAME>(Hold\'em|Omaha\sHi|Omaha\sH/L|7\sCard\sStud|Stud\sH/L|Razz|Stud\sHi))
|
||||||
''' % substitutions, re.VERBOSE)
|
''' % 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_TailSplitHands = re.compile(r"(\n\n+)")
|
||||||
re_HandInfo = re.compile(r'''.*\#(?P<HID>[0-9]+):\s
|
re_HandInfo = re.compile(r'''.*\#(?P<HID>[0-9]+):\s
|
||||||
(?:(?P<TOURNAMENT>.+)\s\((?P<TOURNO>\d+)\),\s)?
|
(?:(?P<TOURNAMENT>.+)\s\((?P<TOURNO>\d+)\),\s)?
|
||||||
|
@ -186,7 +177,10 @@ class Fulltilt(HandHistoryConverter):
|
||||||
|
|
||||||
m = self.re_GameInfo.search(handText)
|
m = self.re_GameInfo.search(handText)
|
||||||
if not m:
|
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()
|
mg = m.groupdict()
|
||||||
|
|
||||||
# translations from captured groups to our info strings
|
# translations from captured groups to our info strings
|
||||||
|
@ -220,7 +214,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
if m is None:
|
if m is None:
|
||||||
logging.info(_("Didn't match re_HandInfo"))
|
logging.info(_("Didn't match re_HandInfo"))
|
||||||
logging.info(hand.handText)
|
logging.info(hand.handText)
|
||||||
raise FpdbParseError("No match in readHandInfo.")
|
raise FpdbParseError(_("No match in readHandInfo."))
|
||||||
hand.handid = m.group('HID')
|
hand.handid = m.group('HID')
|
||||||
hand.tablename = m.group('TABLE')
|
hand.tablename = m.group('TABLE')
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
# Standard Library modules
|
# Standard Library modules
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -33,17 +36,6 @@ import fpdb_import
|
||||||
import Configuration
|
import Configuration
|
||||||
import Exceptions
|
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():
|
class GuiBulkImport():
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<FreePokerToolsConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FreePokerToolsConfig.xsd">
|
<FreePokerToolsConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FreePokerToolsConfig.xsd">
|
||||||
|
|
||||||
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" hhArchiveBase="~/.fpdb/HandHistories/" saveActions="True"></import>
|
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" hhArchiveBase="~/.fpdb/HandHistories/" saveActions="False"></import>
|
||||||
|
|
||||||
<!-- These values determine what stats are displayed in the HUD
|
<!-- These values determine what stats are displayed in the HUD
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
config_difficulty="expert"
|
config_difficulty="expert"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" hhArchiveBase="~/.fpdb/HandHistories/" saveActions="True"></import>
|
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" hhArchiveBase="~/.fpdb/HandHistories/" saveActions="False"></import>
|
||||||
|
|
||||||
<gui_cash_stats>
|
<gui_cash_stats>
|
||||||
<col col_name="game" disp_all="True" disp_posn="True" col_title="Game" xalignment="0.0" field_format="%s" field_type="str" />
|
<col col_name="game" disp_all="True" disp_posn="True" col_title="Game" xalignment="0.0" field_format="%s" field_type="str" />
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Hand(object):
|
||||||
# Class Variables
|
# Class Variables
|
||||||
UPS = {'a':'A', 't':'T', 'j':'J', 'q':'Q', 'k':'K', 'S':'s', 'C':'c', 'H':'h', 'D':'d'}
|
UPS = {'a':'A', 't':'T', 'j':'J', 'q':'Q', 'k':'K', 'S':'s', 'C':'c', 'H':'h', 'D':'d'}
|
||||||
LCS = {'H':'h', 'D':'d', 'C':'c', 'S':'s'}
|
LCS = {'H':'h', 'D':'d', 'C':'c', 'S':'s'}
|
||||||
SYMBOL = {'USD': '$', 'EUR': u'$', 'T$': '', 'play': ''}
|
SYMBOL = {'USD': '$', 'EUR': u'$', 'GBP': '$', 'T$': '', 'play': ''}
|
||||||
MS = {'horse' : 'HORSE', '8game' : '8-Game', 'hose' : 'HOSE', 'ha': 'HA'}
|
MS = {'horse' : 'HORSE', '8game' : '8-Game', 'hose' : 'HOSE', 'ha': 'HA'}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,8 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py.
|
||||||
|
|
||||||
if self.ftpArchive == True:
|
if self.ftpArchive == True:
|
||||||
log.debug(_("Converting ftpArchive format to readable"))
|
log.debug(_("Converting ftpArchive format to readable"))
|
||||||
m = re.compile('^\*\*\*\*\*\*+\s#\s\d+\s\*\*\*\*\*+$', re.MULTILINE)
|
# Remove ******************** # 1 *************************
|
||||||
|
m = re.compile('\*{20}\s#\s\d+\s\*{25}\s+', re.MULTILINE)
|
||||||
self.obs = m.sub('', self.obs)
|
self.obs = m.sub('', self.obs)
|
||||||
|
|
||||||
if self.obs is None or self.obs == "":
|
if self.obs is None or self.obs == "":
|
||||||
|
|
|
@ -45,21 +45,21 @@ else:
|
||||||
except IOError:
|
except IOError:
|
||||||
def _(string): return string
|
def _(string): return string
|
||||||
|
|
||||||
def splitPokerStarsSummaries(summaryText):
|
def splitPokerStarsSummaries(summaryText): #TODO: this needs to go to PSS.py
|
||||||
re_SplitTourneys = PokerStarsSummary.PokerStarsSummary.re_SplitTourneys
|
re_SplitTourneys = PokerStarsSummary.PokerStarsSummary.re_SplitTourneys
|
||||||
splitSummaries = re.split(re_SplitTourneys, summaryText)
|
splitSummaries = re.split(re_SplitTourneys, summaryText)
|
||||||
|
|
||||||
if len(splitSummaries) <= 1:
|
if len(splitSummaries) <= 1:
|
||||||
print _("DEBUG: re_SplitTourneyss isn't matching")
|
print _("DEBUG: re_SplitTourneys isn't matching")
|
||||||
|
|
||||||
return splitSummaries
|
return splitSummaries
|
||||||
|
|
||||||
def splitFullTiltSummaries(summaryText):
|
def splitFullTiltSummaries(summaryText):#TODO: this needs to go to FTPS.py
|
||||||
re_SplitTourneys = FullTiltPokerSummary.FullTiltPokerSummary.re_SplitTourneys
|
re_SplitTourneys = FullTiltPokerSummary.FullTiltPokerSummary.re_SplitTourneys
|
||||||
splitSummaries = re.split(re_SplitTourneys, summaryText)
|
splitSummaries = re.split(re_SplitTourneys, summaryText)
|
||||||
|
|
||||||
if len(splitSummaries) <= 1:
|
if len(splitSummaries) <= 1:
|
||||||
print _("DEBUG: re_SplitTourneyss isn't matching")
|
print _("DEBUG: re_SplitTourneys isn't matching")
|
||||||
|
|
||||||
return splitSummaries
|
return splitSummaries
|
||||||
|
|
||||||
|
|
37
pyfpdb/L10n.py
Normal file
37
pyfpdb/L10n.py
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#Copyright 2010 Steffen Schaumburg
|
||||||
|
#This program is free software: you can redistribute it and/or modify
|
||||||
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
#
|
||||||
|
#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 Affero General Public License
|
||||||
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
import locale
|
||||||
|
def pass_through(to_translate): return to_translate
|
||||||
|
|
||||||
|
(lang, charset) = locale.getdefaultlocale()
|
||||||
|
if lang==None or lang[:2]=="en":
|
||||||
|
translation=pass_through
|
||||||
|
else:
|
||||||
|
import gettext
|
||||||
|
try:
|
||||||
|
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||||
|
trans.install()
|
||||||
|
translation=_
|
||||||
|
except IOError:
|
||||||
|
translation=pass_through
|
||||||
|
|
||||||
|
#def translate(to_translate):
|
||||||
|
# return _(to_translate)
|
||||||
|
|
||||||
|
def get_translation():
|
||||||
|
return translation
|
|
@ -170,6 +170,7 @@ class PokerStars(HandHistoryConverter):
|
||||||
["ring", "stud", "fl"],
|
["ring", "stud", "fl"],
|
||||||
|
|
||||||
["ring", "draw", "fl"],
|
["ring", "draw", "fl"],
|
||||||
|
["ring", "draw", "pl"],
|
||||||
["ring", "draw", "nl"],
|
["ring", "draw", "nl"],
|
||||||
|
|
||||||
["tour", "hold", "nl"],
|
["tour", "hold", "nl"],
|
||||||
|
@ -222,7 +223,7 @@ class PokerStars(HandHistoryConverter):
|
||||||
m2 = self.re_GameInfo.search(hand.handText)
|
m2 = self.re_GameInfo.search(hand.handText)
|
||||||
if m is None or m2 is None:
|
if m is None or m2 is None:
|
||||||
log.error("Didn't match re_HandInfo")
|
log.error("Didn't match re_HandInfo")
|
||||||
raise FpdbParseError("No match in readHandInfo.")
|
raise FpdbParseError(_("No match in readHandInfo."))
|
||||||
|
|
||||||
info.update(m.groupdict())
|
info.update(m.groupdict())
|
||||||
info.update(m2.groupdict())
|
info.update(m2.groupdict())
|
||||||
|
|
|
@ -22,6 +22,18 @@ import sys
|
||||||
import datetime
|
import datetime
|
||||||
from HandHistoryConverter import *
|
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
|
||||||
|
|
||||||
# Win2day HH Format
|
# Win2day HH Format
|
||||||
|
|
||||||
class Win2day(HandHistoryConverter):
|
class Win2day(HandHistoryConverter):
|
||||||
|
@ -88,8 +100,10 @@ class Win2day(HandHistoryConverter):
|
||||||
|
|
||||||
m = self.re_GameInfo.search(handText)
|
m = self.re_GameInfo.search(handText)
|
||||||
if not m:
|
if not m:
|
||||||
print "determineGameType:", handText
|
tmp = handText[0:100]
|
||||||
return None
|
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()
|
mg = m.groupdict()
|
||||||
|
|
||||||
|
@ -98,7 +112,8 @@ class Win2day(HandHistoryConverter):
|
||||||
limits = { 'NL':'nl', 'PL':'pl'}
|
limits = { 'NL':'nl', 'PL':'pl'}
|
||||||
games = { # base, category
|
games = { # base, category
|
||||||
"GAME_THM" : ('hold','holdem'),
|
"GAME_THM" : ('hold','holdem'),
|
||||||
# 'Omaha' : ('hold','omahahi'),
|
"GAME_OMA" : ('hold','omahahi'),
|
||||||
|
|
||||||
#'Omaha Hi/Lo' : ('hold','omahahilo'),
|
#'Omaha Hi/Lo' : ('hold','omahahilo'),
|
||||||
# 'Razz' : ('stud','razz'),
|
# 'Razz' : ('stud','razz'),
|
||||||
#'7 Card Stud' : ('stud','studhi'),
|
#'7 Card Stud' : ('stud','studhi'),
|
||||||
|
@ -182,14 +197,14 @@ class Win2day(HandHistoryConverter):
|
||||||
if street in ('FLOP','TURN','RIVER'): # a list of streets which get dealt community cards (i.e. all but PREFLOP)
|
if street in ('FLOP','TURN','RIVER'): # a list of streets which get dealt community cards (i.e. all but PREFLOP)
|
||||||
#print "DEBUG readCommunityCards:", street, hand.streets.group(street)
|
#print "DEBUG readCommunityCards:", street, hand.streets.group(street)
|
||||||
|
|
||||||
boardCards = set([])
|
boardCards = []
|
||||||
if street == 'FLOP':
|
if street == 'FLOP':
|
||||||
m = self.re_Card.findall(hand.streets[street])
|
m = self.re_Card.findall(hand.streets[street])
|
||||||
for card in m:
|
for card in m:
|
||||||
boardCards.add(self.convertWin2dayCards(card))
|
boardCards.append(self.convertWin2dayCards(card))
|
||||||
else:
|
else:
|
||||||
m = self.re_BoardLast.search(hand.streets[street])
|
m = self.re_BoardLast.search(hand.streets[street])
|
||||||
boardCards.add(self.convertWin2dayCards(m.group('CARD')))
|
boardCards.append(self.convertWin2dayCards(m.group('CARD')))
|
||||||
|
|
||||||
hand.setCommunityCards(street, boardCards)
|
hand.setCommunityCards(street, boardCards)
|
||||||
|
|
||||||
|
@ -225,7 +240,7 @@ class Win2day(HandHistoryConverter):
|
||||||
for found in m:
|
for found in m:
|
||||||
hand.hero = found.group('PNAME')
|
hand.hero = found.group('PNAME')
|
||||||
for card in self.re_Card.finditer(found.group('CARDS')):
|
for card in self.re_Card.finditer(found.group('CARDS')):
|
||||||
print self.convertWin2dayCards(card.group('CARD'))
|
#print self.convertWin2dayCards(card.group('CARD'))
|
||||||
newcards.append(self.convertWin2dayCards(card.group('CARD')))
|
newcards.append(self.convertWin2dayCards(card.group('CARD')))
|
||||||
|
|
||||||
#hand.addHoleCards(holeCards, m.group('PNAME'))
|
#hand.addHoleCards(holeCards, m.group('PNAME'))
|
||||||
|
@ -267,13 +282,13 @@ class Win2day(HandHistoryConverter):
|
||||||
newcards = player.group('NEWCARDS')
|
newcards = player.group('NEWCARDS')
|
||||||
oldcards = player.group('OLDCARDS')
|
oldcards = player.group('OLDCARDS')
|
||||||
if newcards == None:
|
if newcards == None:
|
||||||
newcards = set()
|
newcards = []
|
||||||
else:
|
else:
|
||||||
newcards = set(newcards.split(' '))
|
newcards = newcards.split(' ')
|
||||||
if oldcards == None:
|
if oldcards == None:
|
||||||
oldcards = set()
|
oldcards = []
|
||||||
else:
|
else:
|
||||||
oldcards = set(oldcards.split(' '))
|
oldcards = oldcards.split(' ')
|
||||||
hand.addDrawHoleCards(newcards, oldcards, player.group('PNAME'), street)
|
hand.addDrawHoleCards(newcards, oldcards, player.group('PNAME'), street)
|
||||||
|
|
||||||
|
|
||||||
|
@ -337,10 +352,10 @@ class Win2day(HandHistoryConverter):
|
||||||
|
|
||||||
def readShowdownActions(self, hand):
|
def readShowdownActions(self, hand):
|
||||||
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
||||||
showdownCards = set([])
|
showdownCards = []
|
||||||
for card in self.re_Card.finditer(shows.group('CARDS')):
|
for card in self.re_Card.finditer(shows.group('CARDS')):
|
||||||
#print "DEBUG:", card, card.group('CARD'), self.convertWin2dayCards(card.group('CARD'))
|
#print "DEBUG:", card, card.group('CARD'), self.convertWin2dayCards(card.group('CARD'))
|
||||||
showdownCards.add(self.convertWin2dayCards(card.group('CARD')))
|
showdownCards.append(self.convertWin2dayCards(card.group('CARD')))
|
||||||
|
|
||||||
hand.addShownCards(showdownCards, shows.group('PNAME'))
|
hand.addShownCards(showdownCards, shows.group('PNAME'))
|
||||||
|
|
||||||
|
@ -354,7 +369,7 @@ class Win2day(HandHistoryConverter):
|
||||||
for m in self.re_ShownCards.finditer(hand.handText):
|
for m in self.re_ShownCards.finditer(hand.handText):
|
||||||
if m.group('CARDS') is not None:
|
if m.group('CARDS') is not None:
|
||||||
cards = m.group('CARDS')
|
cards = m.group('CARDS')
|
||||||
cards = set(cards.split(' '))
|
cards = cards.split(' ')
|
||||||
hand.addShownCards(cards=cards, player=m.group('PNAME'))
|
hand.addShownCards(cards=cards, player=m.group('PNAME'))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -15,23 +15,14 @@
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import Queue
|
import Queue
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
# if path is set to use an old version of python look for a new one:
|
# if path is set to use an old version of python look for a new one:
|
||||||
# (does this work in linux?)
|
# (does this work in linux?)
|
||||||
if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6', '2.7') and '-r' not in sys.argv:
|
if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6', '2.7') and '-r' not in sys.argv:
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
# Standard Library modules
|
# Standard Library modules
|
||||||
|
|
||||||
import os # todo: remove this once import_dir is in fpdb_import
|
import os # todo: remove this once import_dir is in fpdb_import
|
||||||
|
@ -35,18 +38,6 @@ log = logging.getLogger("importer")
|
||||||
import pygtk
|
import pygtk
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
# fpdb/FreePokerTools modules
|
# fpdb/FreePokerTools modules
|
||||||
import Database
|
import Database
|
||||||
import Configuration
|
import Configuration
|
||||||
|
@ -473,7 +464,8 @@ class Importer:
|
||||||
else:
|
else:
|
||||||
self.pos_in_file[file] = 0
|
self.pos_in_file[file] = 0
|
||||||
hhc = obj( self.config, in_path = file, out_path = out_path, index = idx
|
hhc = obj( self.config, in_path = file, out_path = out_path, index = idx
|
||||||
, starsArchive = self.settings['starsArchive'], sitename = site )
|
, starsArchive = self.settings['starsArchive'], ftpArchive = self.settings['ftpArchive'],
|
||||||
|
sitename = site )
|
||||||
if hhc.getStatus():
|
if hhc.getStatus():
|
||||||
handlist = hhc.getProcessedHands()
|
handlist = hhc.getProcessedHands()
|
||||||
self.pos_in_file[file] = hhc.getLastCharacterRead()
|
self.pos_in_file[file] = hhc.getLastCharacterRead()
|
||||||
|
|
|
@ -71,17 +71,16 @@ class iPoker(HandHistoryConverter):
|
||||||
re_GameInfo = re.compile(r'<gametype>(?P<GAME>[a-zA-Z0-9 ]+) \$(?P<SB>[.0-9]+)/\$(?P<BB>[.0-9]+)</gametype>', re.MULTILINE)
|
re_GameInfo = re.compile(r'<gametype>(?P<GAME>[a-zA-Z0-9 ]+) \$(?P<SB>[.0-9]+)/\$(?P<BB>[.0-9]+)</gametype>', re.MULTILINE)
|
||||||
re_HandInfo = re.compile(r'gamecode="(?P<HID>[0-9]+)">\s+<general>\s+<startdate>(?P<DATETIME>[-: 0-9]+)</startdate>', re.MULTILINE)
|
re_HandInfo = re.compile(r'gamecode="(?P<HID>[0-9]+)">\s+<general>\s+<startdate>(?P<DATETIME>[-: 0-9]+)</startdate>', re.MULTILINE)
|
||||||
re_Button = re.compile(r'<players dealer="(?P<BUTTON>[0-9]+)">')
|
re_Button = re.compile(r'<players dealer="(?P<BUTTON>[0-9]+)">')
|
||||||
re_PlayerInfo = re.compile(r'<player seat="(?P<SEAT>[0-9]+)" name="(?P<PNAME>[^"]+)" chips="\$(?P<CASH>[.0-9]+)" dealer="(?P<DEALTIN>(0|1))"', re.MULTILINE)
|
re_PlayerInfo = re.compile(r'<player seat="(?P<SEAT>[0-9]+)" name="(?P<PNAME>[^"]+)" chips="\$(?P<CASH>[.0-9]+)" dealer="(?P<DEALTIN>(0|1))" (?P<WIN>win="\$[^"]+") (bet="\$(?P<BET>[^"]+))?', re.MULTILINE)
|
||||||
re_Board = re.compile(r'<cards type="COMMUNITY" cards="(?P<CARDS>[^"]+)"', re.MULTILINE)
|
re_Board = re.compile(r'<cards type="COMMUNITY" cards="(?P<CARDS>[^"]+)"', re.MULTILINE)
|
||||||
re_EndOfHand = re.compile(r'<round id="END_OF_GAME"', re.MULTILINE)
|
re_EndOfHand = re.compile(r'<round id="END_OF_GAME"', re.MULTILINE)
|
||||||
|
|
||||||
re_PostSB = re.compile(r'<event sequence="[0-9]+" type="(SMALL_BLIND|RETURN_BLIND)" player="(?P<PSEAT>[0-9])" amount="(?P<SB>[.0-9]+)"/>', re.MULTILINE)
|
re_PostSB = re.compile(r'<event sequence="[0-9]+" type="(SMALL_BLIND|RETURN_BLIND)" player="(?P<PSEAT>[0-9])" amount="(?P<SB>[.0-9]+)"/>', re.MULTILINE)
|
||||||
re_PostBB = re.compile(r'<event sequence="[0-9]+" type="(BIG_BLIND|INITIAL_BLIND)" player="(?P<PSEAT>[0-9])" amount="(?P<BB>[.0-9]+)"/>', re.MULTILINE)
|
re_PostBB = re.compile(r'<event sequence="[0-9]+" type="(BIG_BLIND|INITIAL_BLIND)" player="(?P<PSEAT>[0-9])" amount="(?P<BB>[.0-9]+)"/>', re.MULTILINE)
|
||||||
re_PostBoth = re.compile(r'<event sequence="[0-9]+" type="(RETURN_BLIND)" player="(?P<PSEAT>[0-9])" amount="(?P<SBBB>[.0-9]+)"/>', re.MULTILINE)
|
re_PostBoth = re.compile(r'<event sequence="[0-9]+" type="(RETURN_BLIND)" player="(?P<PSEAT>[0-9])" amount="(?P<SBBB>[.0-9]+)"/>', re.MULTILINE)
|
||||||
#re_Antes = ???
|
|
||||||
#re_BringIn = ???
|
|
||||||
re_HeroCards = re.compile(r'<cards type="HOLE" cards="(?P<CARDS>.+)" player="(?P<PSEAT>[0-9])"', re.MULTILINE)
|
re_HeroCards = re.compile(r'<cards type="HOLE" cards="(?P<CARDS>.+)" player="(?P<PSEAT>[0-9])"', re.MULTILINE)
|
||||||
re_Action = re.compile(r'<action no="[0-9]+" player="(?P<PNAME>[^"]+)" type="(?P<ATYPE>0|3|4|16)" sum="\$(?P<BET>[.0-9]+)"', re.MULTILINE)
|
re_Action = re.compile(r'<action no="[0-9]+" player="(?P<PNAME>[^"]+)" type="(?P<ATYPE>\d+)" sum="\$(?P<BET>[.0-9]+)"', re.MULTILINE)
|
||||||
|
re_Ante = re.compile(r'<action no="[0-9]+" player="(?P<PNAME>[^"]+)" type="(?P<ATYPE>15)" sum="\$(?P<BET>[.0-9]+)" cards="', re.MULTILINE)
|
||||||
re_ShowdownAction = re.compile(r'<cards type="SHOWN" cards="(?P<CARDS>..,..)" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE)
|
re_ShowdownAction = re.compile(r'<cards type="SHOWN" cards="(?P<CARDS>..,..)" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE)
|
||||||
re_CollectPot = re.compile(r'<winner amount="(?P<POT>[.0-9]+)" uncalled="(true|false)" potnumber="[0-9]+" player="(?P<PSEAT>[0-9])"', re.MULTILINE)
|
re_CollectPot = re.compile(r'<winner amount="(?P<POT>[.0-9]+)" uncalled="(true|false)" potnumber="[0-9]+" player="(?P<PSEAT>[0-9])"', re.MULTILINE)
|
||||||
re_SitsOut = re.compile(r'<event sequence="[0-9]+" type="SIT_OUT" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE)
|
re_SitsOut = re.compile(r'<event sequence="[0-9]+" type="SIT_OUT" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE)
|
||||||
|
@ -135,7 +134,7 @@ or None if we fail to get the info """
|
||||||
|
|
||||||
self.info = {}
|
self.info = {}
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
print "DEBUG: m.groupdict(): %s" % mg
|
#print "DEBUG: m.groupdict(): %s" % mg
|
||||||
|
|
||||||
limits = { 'No Limit':'nl', 'Limit':'fl' }
|
limits = { 'No Limit':'nl', 'Limit':'fl' }
|
||||||
games = { # base, category
|
games = { # base, category
|
||||||
|
@ -167,17 +166,18 @@ or None if we fail to get the info """
|
||||||
logging.info(hand.handText)
|
logging.info(hand.handText)
|
||||||
raise FpdbParseError(_("Didn't match re_HandInfo"))
|
raise FpdbParseError(_("Didn't match re_HandInfo"))
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
print "DEBUG: m.groupdict(): %s" % mg
|
#print "DEBUG: m.groupdict(): %s" % mg
|
||||||
hand.handid = m.group('HID')
|
hand.handid = m.group('HID')
|
||||||
#hand.tablename = m.group('TABLE')[:-1]
|
#hand.tablename = m.group('TABLE')[:-1]
|
||||||
hand.maxseats = None
|
hand.maxseats = None
|
||||||
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), '%Y-%m-%d %H:%M:%S')
|
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), '%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
def readPlayerStacks(self, hand):
|
def readPlayerStacks(self, hand):
|
||||||
|
print "DEBUG: readPlayerStacks"
|
||||||
m = self.re_PlayerInfo.finditer(hand.handText)
|
m = self.re_PlayerInfo.finditer(hand.handText)
|
||||||
for a in m:
|
for a in m:
|
||||||
ag = a.groupdict()
|
ag = a.groupdict()
|
||||||
print "DEBUG: ag: %s" %ag
|
#print "DEBUG: re_PlayerInfo: %s" %ag
|
||||||
seatno = int(a.group('SEAT'))
|
seatno = int(a.group('SEAT'))
|
||||||
# It may be necessary to adjust 'hand.maxseats', which is an
|
# It may be necessary to adjust 'hand.maxseats', which is an
|
||||||
# educated guess, starting with 2 (indicating a heads-up table) and
|
# educated guess, starting with 2 (indicating a heads-up table) and
|
||||||
|
@ -213,10 +213,13 @@ or None if we fail to get the info """
|
||||||
hand.setCommunityCards(street, [m.group('CARDS').split(',')[-1]])
|
hand.setCommunityCards(street, [m.group('CARDS').split(',')[-1]])
|
||||||
|
|
||||||
def readAntes(self, hand):
|
def readAntes(self, hand):
|
||||||
pass # ???
|
m = self.re_Ante.finditer(hand.handText)
|
||||||
|
for a in m:
|
||||||
|
#print "DEBUG: addAnte(%s, %s)" %(a.group('PNAME'), a.group('BET'))
|
||||||
|
hand.addAnte(a.group('PNAME'), a.group('BET'))
|
||||||
|
|
||||||
def readBringIn(self, hand):
|
def readBringIn(self, hand):
|
||||||
pass # ???
|
pass
|
||||||
|
|
||||||
def readBlinds(self, hand):
|
def readBlinds(self, hand):
|
||||||
m = self.re_PostSB.search(hand.handText)
|
m = self.re_PostSB.search(hand.handText)
|
||||||
|
@ -241,21 +244,28 @@ or None if we fail to get the info """
|
||||||
m = self.re_Action.finditer(hand.streets[street])
|
m = self.re_Action.finditer(hand.streets[street])
|
||||||
for action in m:
|
for action in m:
|
||||||
ag = action.groupdict()
|
ag = action.groupdict()
|
||||||
print "DEBUG: action.groupdict: %s" % ag
|
#print "DEBUG: action.groupdict: %s" % ag
|
||||||
logging.debug("%s %s" % (action.group('ATYPE'),
|
logging.debug("%s %s" % (action.group('ATYPE'),
|
||||||
action.groupdict()))
|
action.groupdict()))
|
||||||
if action.group('ATYPE') == 'RAISE':
|
if action.group('ATYPE') == 'RAISE': # Still no example for raise (i think?)
|
||||||
hand.addCallandRaise(street, player, action.group('BET'))
|
hand.addCallandRaise(street, player, action.group('BET'))
|
||||||
elif action.group('ATYPE') == '3': # Believe this is 'call'
|
elif action.group('ATYPE') == '3': # Believe this is 'call'
|
||||||
|
#print "DEBUG: addCall(%s, %s, %s)" %(street, action.group('PNAME'), action.group('BET'))
|
||||||
hand.addCall(street, action.group('PNAME'), action.group('BET'))
|
hand.addCall(street, action.group('PNAME'), action.group('BET'))
|
||||||
elif action.group('ATYPE') == 'BET':
|
elif action.group('ATYPE') == '5':
|
||||||
hand.addBet(street, player, action.group('BET'))
|
#print "DEBUG: addBet(%s, %s, %s)" %(street, action.group('PNAME'), action.group('BET'))
|
||||||
|
hand.addBet(street, action.group('PNAME'), action.group('BET'))
|
||||||
elif action.group('ATYPE') == '0': # Belive this is 'fold'
|
elif action.group('ATYPE') == '0': # Belive this is 'fold'
|
||||||
|
#print "DEBUG: addFold(%s, %s)" %(street, action.group('PNAME'))
|
||||||
hand.addFold(street, action.group('PNAME'))
|
hand.addFold(street, action.group('PNAME'))
|
||||||
elif action.group('ATYPE') == 'CHECK':
|
elif action.group('ATYPE') == '4':
|
||||||
hand.addCheck(street, player)
|
#print "DEBUG: addCheck(%s, %s)" %(street, action.group('PNAME'))
|
||||||
elif action.group('ATYPE') == 'ALL_IN':
|
hand.addCheck(street, action.group('PNAME'))
|
||||||
hand.addAllIn(street, player, action.group('BET'))
|
#elif action.group('ATYPE') == 'ALL_IN':
|
||||||
|
# hand.addAllIn(street, player, action.group('BET'))
|
||||||
|
elif action.group('ATYPE') == '16': #BringIn
|
||||||
|
#print "DEBUG: addBringIn(%s, %s)" %(action.group('PNAME'), action.group('BET'))
|
||||||
|
hand.addBringIn(action.group('PNAME'), action.group('BET'))
|
||||||
else:
|
else:
|
||||||
logging.error(_("Unimplemented readAction: %s" % (ag)))
|
logging.error(_("Unimplemented readAction: %s" % (ag)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user