Merge branch 'master' of git://git.assembla.com/fpdboz

This commit is contained in:
DoNoBaN 2011-02-08 07:25:51 +01:00
commit 3490ec8091
23 changed files with 327 additions and 263 deletions

View File

@ -1930,100 +1930,99 @@ class Database:
#print "DEBUG: %s %s %s" %(hid, pids, pdata) #print "DEBUG: %s %s %s" %(hid, pids, pdata)
inserts = [] inserts = []
for p in pdata: for p in pdata:
#NOTE: Insert new stats at right place because SQL needs strict order line = [0]*89
line = []
line.append(1) # HDs line[0] = 1 # HDs
line.append(pdata[p]['street0VPI']) if pdata[p]['street0VPI']: line[1] = 1
line.append(pdata[p]['street0Aggr']) if pdata[p]['street0Aggr']: line[2] = 1
line.append(pdata[p]['street0_3BChance']) if pdata[p]['street0_3BChance']: line[3] = 1
line.append(pdata[p]['street0_3BDone']) if pdata[p]['street0_3BDone']: line[4] = 1
line.append(pdata[p]['street0_4BChance']) if pdata[p]['street0_4BChance']: line[5] = 1
line.append(pdata[p]['street0_4BDone']) if pdata[p]['street0_4BDone']: line[6] = 1
line.append(pdata[p]['street0_FoldTo3BChance']) if pdata[p]['street0_FoldTo3BChance']: line[7] = 1
line.append(pdata[p]['street0_FoldTo3BDone']) if pdata[p]['street0_FoldTo3BDone']: line[8] = 1
line.append(pdata[p]['street0_FoldTo4BChance']) if pdata[p]['street0_FoldTo4BChance']: line[9] = 1
line.append(pdata[p]['street0_FoldTo4BDone']) if pdata[p]['street0_FoldTo4BDone']: line[10] = 1
line.append(pdata[p]['other3BStreet0']) if pdata[p]['other3BStreet0']: line[11] = 1
line.append(pdata[p]['other4BStreet0']) if pdata[p]['other4BStreet0']: line[12] = 1
line.append(pdata[p]['street1Seen']) if pdata[p]['street1Seen']: line[13] = 1
line.append(pdata[p]['street2Seen']) if pdata[p]['street2Seen']: line[14] = 1
line.append(pdata[p]['street3Seen']) if pdata[p]['street3Seen']: line[15] = 1
line.append(pdata[p]['street4Seen']) if pdata[p]['street4Seen']: line[16] = 1
line.append(pdata[p]['sawShowdown']) if pdata[p]['sawShowdown']: line[17] = 1
line.append(pdata[p]['street1Aggr']) if pdata[p]['street1Aggr']: line[18] = 1
line.append(pdata[p]['street2Aggr']) if pdata[p]['street2Aggr']: line[19] = 1
line.append(pdata[p]['street3Aggr']) if pdata[p]['street3Aggr']: line[20] = 1
line.append(pdata[p]['street4Aggr']) if pdata[p]['street4Aggr']: line[21] = 1
line.append(pdata[p]['otherRaisedStreet0']) if pdata[p]['otherRaisedStreet0']: line[22] = 1
line.append(pdata[p]['otherRaisedStreet1']) if pdata[p]['otherRaisedStreet1']: line[23] = 1
line.append(pdata[p]['otherRaisedStreet2']) if pdata[p]['otherRaisedStreet2']: line[24] = 1
line.append(pdata[p]['otherRaisedStreet3']) if pdata[p]['otherRaisedStreet3']: line[25] = 1
line.append(pdata[p]['otherRaisedStreet4']) if pdata[p]['otherRaisedStreet4']: line[26] = 1
line.append(pdata[p]['foldToOtherRaisedStreet0']) if pdata[p]['foldToOtherRaisedStreet0']: line[27] = 1
line.append(pdata[p]['foldToOtherRaisedStreet1']) if pdata[p]['foldToOtherRaisedStreet1']: line[28] = 1
line.append(pdata[p]['foldToOtherRaisedStreet2']) if pdata[p]['foldToOtherRaisedStreet2']: line[29] = 1
line.append(pdata[p]['foldToOtherRaisedStreet3']) if pdata[p]['foldToOtherRaisedStreet3']: line[30] = 1
line.append(pdata[p]['foldToOtherRaisedStreet4']) if pdata[p]['foldToOtherRaisedStreet4']: line[31] = 1
line.append(pdata[p]['wonWhenSeenStreet1']) line[32] = pdata[p]['wonWhenSeenStreet1']
line.append(pdata[p]['wonWhenSeenStreet2']) line[33] = pdata[p]['wonWhenSeenStreet2']
line.append(pdata[p]['wonWhenSeenStreet3']) line[34] = pdata[p]['wonWhenSeenStreet3']
line.append(pdata[p]['wonWhenSeenStreet4']) line[35] = pdata[p]['wonWhenSeenStreet4']
line.append(pdata[p]['wonAtSD']) line[36] = pdata[p]['wonAtSD']
line.append(pdata[p]['raiseFirstInChance']) if pdata[p]['raiseFirstInChance']: line[37] = 1
line.append(pdata[p]['raisedFirstIn']) if pdata[p]['raisedFirstIn']: line[38] = 1
line.append(pdata[p]['foldBbToStealChance']) if pdata[p]['foldBbToStealChance']: line[39] = 1
line.append(pdata[p]['foldedBbToSteal']) if pdata[p]['foldedBbToSteal']: line[40] = 1
line.append(pdata[p]['foldSbToStealChance']) if pdata[p]['foldSbToStealChance']: line[41] = 1
line.append(pdata[p]['foldedSbToSteal']) if pdata[p]['foldedSbToSteal']: line[42] = 1
line.append(pdata[p]['street1CBChance']) if pdata[p]['street1CBChance']: line[43] = 1
line.append(pdata[p]['street1CBDone']) if pdata[p]['street1CBDone']: line[44] = 1
line.append(pdata[p]['street2CBChance']) if pdata[p]['street2CBChance']: line[45] = 1
line.append(pdata[p]['street2CBDone']) if pdata[p]['street2CBDone']: line[46] = 1
line.append(pdata[p]['street3CBChance']) if pdata[p]['street3CBChance']: line[47] = 1
line.append(pdata[p]['street3CBDone']) if pdata[p]['street3CBDone']: line[48] = 1
line.append(pdata[p]['street4CBChance']) if pdata[p]['street4CBChance']: line[49] = 1
line.append(pdata[p]['street4CBDone']) if pdata[p]['street4CBDone']: line[50] = 1
line.append(pdata[p]['foldToStreet1CBChance']) if pdata[p]['foldToStreet1CBChance']: line[51] = 1
line.append(pdata[p]['foldToStreet1CBDone']) if pdata[p]['foldToStreet1CBDone']: line[52] = 1
line.append(pdata[p]['foldToStreet2CBChance']) if pdata[p]['foldToStreet2CBChance']: line[53] = 1
line.append(pdata[p]['foldToStreet2CBDone']) if pdata[p]['foldToStreet2CBDone']: line[54] = 1
line.append(pdata[p]['foldToStreet3CBChance']) if pdata[p]['foldToStreet3CBChance']: line[55] = 1
line.append(pdata[p]['foldToStreet3CBDone']) if pdata[p]['foldToStreet3CBDone']: line[56] = 1
line.append(pdata[p]['foldToStreet4CBChance']) if pdata[p]['foldToStreet4CBChance']: line[57] = 1
line.append(pdata[p]['foldToStreet4CBDone']) if pdata[p]['foldToStreet4CBDone']: line[58] = 1
line.append(pdata[p]['totalProfit']) line[59] = pdata[p]['totalProfit']
line.append(pdata[p]['street1CheckCallRaiseChance']) if pdata[p]['street1CheckCallRaiseChance']: line[60] = 1
line.append(pdata[p]['street1CheckCallRaiseDone']) if pdata[p]['street1CheckCallRaiseDone']: line[61] = 1
line.append(pdata[p]['street2CheckCallRaiseChance']) if pdata[p]['street2CheckCallRaiseChance']: line[62] = 1
line.append(pdata[p]['street2CheckCallRaiseDone']) if pdata[p]['street2CheckCallRaiseDone']: line[63] = 1
line.append(pdata[p]['street3CheckCallRaiseChance']) if pdata[p]['street3CheckCallRaiseChance']: line[64] = 1
line.append(pdata[p]['street3CheckCallRaiseDone']) if pdata[p]['street3CheckCallRaiseDone']: line[65] = 1
line.append(pdata[p]['street4CheckCallRaiseChance']) if pdata[p]['street4CheckCallRaiseChance']: line[66] = 1
line.append(pdata[p]['street4CheckCallRaiseDone']) if pdata[p]['street4CheckCallRaiseDone']: line[67] = 1
line.append(pdata[p]['street0Calls']) if pdata[p]['street0Calls']: line[68] = 1
line.append(pdata[p]['street1Calls']) if pdata[p]['street1Calls']: line[69] = 1
line.append(pdata[p]['street2Calls']) if pdata[p]['street2Calls']: line[70] = 1
line.append(pdata[p]['street3Calls']) if pdata[p]['street3Calls']: line[71] = 1
line.append(pdata[p]['street4Calls']) if pdata[p]['street4Calls']: line[72] = 1
line.append(pdata[p]['street0Bets']) if pdata[p]['street0Bets']: line[73] = 1
line.append(pdata[p]['street1Bets']) if pdata[p]['street1Bets']: line[74] = 1
line.append(pdata[p]['street2Bets']) if pdata[p]['street2Bets']: line[75] = 1
line.append(pdata[p]['street3Bets']) if pdata[p]['street3Bets']: line[76] = 1
line.append(pdata[p]['street4Bets']) if pdata[p]['street4Bets']: line[77] = 1
line.append(pdata[p]['street0Raises']) if pdata[p]['street0Raises']: line[78] = 1
line.append(pdata[p]['street1Raises']) if pdata[p]['street1Raises']: line[79] = 1
line.append(pdata[p]['street2Raises']) if pdata[p]['street2Raises']: line[80] = 1
line.append(pdata[p]['street3Raises']) if pdata[p]['street3Raises']: line[81] = 1
line.append(pdata[p]['street4Raises']) if pdata[p]['street4Raises']: line[82] = 1
line.append(gid) # gametypeId line[83] = gid # gametypeId
line.append(pids[p]) # playerId line[84] = pids[p] # playerId
line.append(len(pids)) # activeSeats line[85] = len(pids) # activeSeats
pos = {'B':'B', 'S':'S', 0:'D', 1:'C', 2:'M', 3:'M', 4:'M', 5:'E', 6:'E', 7:'E', 8:'E', 9:'E' } pos = {'B':'B', 'S':'S', 0:'D', 1:'C', 2:'M', 3:'M', 4:'M', 5:'E', 6:'E', 7:'E', 8:'E', 9:'E' }
line.append(pos[pdata[p]['position']]) line[86] = pos[pdata[p]['position']]
line.append(pdata[p]['tourneyTypeId']) line[87] = pdata[p]['tourneyTypeId']
line.append(styleKey) # styleKey line[88] = styleKey # styleKey
inserts.append(line) inserts.append(line)

View File

@ -420,12 +420,15 @@ class Filters(threading.Thread):
self.limits[limit] = w.get_active() self.limits[limit] = w.get_active()
log.debug(_("self.limit[%s] set to %s") %(limit, self.limits[limit])) log.debug(_("self.limit[%s] set to %s") %(limit, self.limits[limit]))
if limit.isdigit() or (len(limit) > 2 and (limit[-2:] == 'nl' or limit[-2:] == 'fl' or limit[-2:] == 'pl')): if limit.isdigit() or (len(limit) > 2 and (limit[-2:] == 'nl' or limit[-2:] == 'fl' or limit[-2:] == 'pl')):
# turning a leaf limit on with 'None' checked turns 'None' off
if self.limits[limit]: if self.limits[limit]:
if self.cbNoLimits is not None: if self.cbNoLimits is not None:
self.cbNoLimits.set_active(False) self.cbNoLimits.set_active(False)
# turning a leaf limit off with 'All' checked turns 'All' off
else: else:
if self.cbAllLimits is not None: if self.cbAllLimits is not None:
self.cbAllLimits.set_active(False) self.cbAllLimits.set_active(False)
# turning off a leaf limit turns off the corresponding fl. nl, or pl
if not self.limits[limit]: if not self.limits[limit]:
if limit.isdigit(): if limit.isdigit():
if self.cbFL is not None: if self.cbFL is not None:
@ -438,24 +441,28 @@ class Filters(threading.Thread):
self.cbPL.set_active(False) self.cbPL.set_active(False)
elif limit == "all": elif limit == "all":
if self.limits[limit]: if self.limits[limit]:
#for cb in self.cbLimits.values(): if self.num_limit_types == 1:
# cb.set_active(True) for cb in self.cbLimits.values():
if self.cbFL is not None: cb.set_active(True)
self.cbFL.set_active(True) else:
if self.cbNL is not None: if self.cbFL is not None:
self.cbNL.set_active(True) self.cbFL.set_active(True)
if self.cbPL is not None: if self.cbNL is not None:
self.cbPL.set_active(True) self.cbNL.set_active(True)
if self.cbPL is not None:
self.cbPL.set_active(True)
elif limit == "none": elif limit == "none":
if self.limits[limit]: if self.limits[limit]:
for cb in self.cbLimits.values(): if self.num_limit_types == 1:
cb.set_active(False) for cb in self.cbLimits.values():
if self.cbNL is not None: cb.set_active(False)
self.cbNL.set_active(False) else:
if self.cbFL is not None: if self.cbNL is not None:
self.cbFL.set_active(False) self.cbNL.set_active(False)
if self.cbPL is not None: if self.cbFL is not None:
self.cbPL.set_active(False) self.cbFL.set_active(False)
if self.cbPL is not None:
self.cbPL.set_active(False)
elif limit == "fl": elif limit == "fl":
if not self.limits[limit]: if not self.limits[limit]:
# only toggle all fl limits off if they are all currently on # only toggle all fl limits off if they are all currently on
@ -765,11 +772,11 @@ class Filters(threading.Thread):
dest = vbox3 # for ring/tour buttons dest = vbox3 # for ring/tour buttons
if "LimitType" in display and display["LimitType"] == True: if "LimitType" in display and display["LimitType"] == True:
num_limit_types = 0 self.num_limit_types = 0
if self.found['fl']: num_limit_types = num_limit_types + 1 if self.found['fl']: self.num_limit_types = self.num_limit_types + 1
if self.found['pl']: num_limit_types = num_limit_types + 1 if self.found['pl']: self.num_limit_types = self.num_limit_types + 1
if self.found['nl']: num_limit_types = num_limit_types + 1 if self.found['nl']: self.num_limit_types = self.num_limit_types + 1
if num_limit_types > 1: if self.num_limit_types > 1:
if self.found['fl']: if self.found['fl']:
hbox = gtk.HBox(False, 0) hbox = gtk.HBox(False, 0)
vbox3.pack_start(hbox, False, False, 0) vbox3.pack_start(hbox, False, False, 0)

View File

@ -49,6 +49,7 @@ class Fulltilt(HandHistoryConverter):
'6.00': ('1.00', '3.00'), '6': ('1.00', '3.00'), '6.00': ('1.00', '3.00'), '6': ('1.00', '3.00'),
'8.00': ('2.00', '4.00'), '8': ('2.00', '4.00'), '8.00': ('2.00', '4.00'), '8': ('2.00', '4.00'),
'10.00': ('2.00', '5.00'), '10': ('2.00', '5.00'), '10.00': ('2.00', '5.00'), '10': ('2.00', '5.00'),
'16.00': ('4.00', '8.00'), '16': ('4.00', '8.00'),
'20.00': ('5.00', '10.00'), '20': ('5.00', '10.00'), '20.00': ('5.00', '10.00'), '20': ('5.00', '10.00'),
'30.00': ('10.00', '15.00'), '30': ('10.00', '15.00'), '30.00': ('10.00', '15.00'), '30': ('10.00', '15.00'),
'40.00': ('10.00', '20.00'), '40': ('10.00', '20.00'), '40.00': ('10.00', '20.00'), '40': ('10.00', '20.00'),
@ -88,7 +89,7 @@ class Fulltilt(HandHistoryConverter):
[%(LS)s]?(?P<CAP>[.0-9]+\sCap\s)? [%(LS)s]?(?P<CAP>[.0-9]+\sCap\s)?
(?P<GAMETYPE>[-\da-zA-Z\/\'\s]+)\s-\s (?P<GAMETYPE>[-\da-zA-Z\/\'\s]+)\s-\s
(?P<DATETIME>.*$) (?P<DATETIME>.*$)
(?P<PARTIAL>\(partial\))?\n (?P<PARTIAL>\(partial\))?\s
(?:.*?\n(?P<CANCELLED>Hand\s\#(?P=HID)\shas\sbeen\scanceled))? (?:.*?\n(?P<CANCELLED>Hand\s\#(?P=HID)\shas\sbeen\scanceled))?
''' % substitutions, re.MULTILINE|re.VERBOSE) ''' % substitutions, re.MULTILINE|re.VERBOSE)
re_TourneyExtraInfo = re.compile('''(((?P<TOURNEY_NAME>[^$]+)? re_TourneyExtraInfo = re.compile('''(((?P<TOURNEY_NAME>[^$]+)?
@ -147,7 +148,7 @@ class Fulltilt(HandHistoryConverter):
re_Mixed = re.compile(r'\s\-\s(?P<MIXED>HA|HORSE|HOSE)\s\-\s', re.VERBOSE) re_Mixed = re.compile(r'\s\-\s(?P<MIXED>HA|HORSE|HOSE)\s\-\s', re.VERBOSE)
re_Max = re.compile("(?P<MAX>\d+)( max)?", re.MULTILINE) re_Max = re.compile("(?P<MAX>\d+)( max)?", re.MULTILINE)
# NB: if we ever match "Full Tilt Poker" we should also match "FullTiltPoker", which PT Stud erroneously exports. # NB: if we ever match "Full Tilt Poker" we should also match "FullTiltPoker", which PT Stud erroneously exports.
re_DateTime = re.compile("""((?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\s(?P<TZ>\w+)\s-\s(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})|(?P<H2>[0-9]+):(?P<MIN2>[0-9]+)\s(?P<TZ2>\w+)\s-\s\w+\,\s(?P<M2>\w+)\s(?P<D2>\d+)\,\s(?P<Y2>[0-9]{4}))""", re.MULTILINE) re_DateTime = re.compile("""((?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\s(?P<TZ>\w+)\s-\s(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})|(?P<H2>[0-9]+):(?P<MIN2>[0-9]+)\s(?P<TZ2>\w+)\s-\s\w+\,\s(?P<M2>\w+)\s(?P<D2>\d+)\,\s(?P<Y2>[0-9]{4}))(?P<PARTIAL>\s\(partial\))?""", re.MULTILINE)
@ -283,10 +284,13 @@ class Fulltilt(HandHistoryConverter):
datetimestr = "%s/%s/%s %s:%s" % (a.group('Y2'), a.group('M2'),a.group('D2'),a.group('H2'),a.group('MIN2')) datetimestr = "%s/%s/%s %s:%s" % (a.group('Y2'), a.group('M2'),a.group('D2'),a.group('H2'),a.group('MIN2'))
timezone = a.group('TZ2') timezone = a.group('TZ2')
hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%B/%d %H:%M") hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%B/%d %H:%M")
if a.group('PARTIAL'):
raise FpdbParseError(hid=m.group('HID'))
hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, timezone, "UTC") hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, timezone, "UTC")
if m.group("CANCELLED") or m.group("PARTIAL"): if m.group("CANCELLED") or m.group("PARTIAL"):
# It would appear this can't be triggered as DATETIME is a bit greedy
raise FpdbParseError(hid=m.group('HID')) raise FpdbParseError(hid=m.group('HID'))
if m.group('TABLEATTRIBUTES'): if m.group('TABLEATTRIBUTES'):
@ -351,7 +355,7 @@ class Fulltilt(HandHistoryConverter):
n = self.re_SummarySitout.finditer(post) n = self.re_SummarySitout.finditer(post)
for b in n: for b in n:
del plist[b.group('PNAME')] del plist[b.group('PNAME')]
print "DEBUG: Deleting '%s' from player dict" %(b.group('PNAME')) #print "DEBUG: Deleting '%s' from player dict" %(b.group('PNAME'))
# Add remaining players # Add remaining players
for a in plist: for a in plist:

View File

@ -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')
@ -22,18 +25,6 @@ import gtk
import os import os
from time import time, strftime from time import time, strftime
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 fpdb_import import fpdb_import
import Database import Database
import Filters import Filters

View File

@ -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 xml.dom.minidom import xml.dom.minidom
from xml.dom.minidom import Node from xml.dom.minidom import Node
@ -23,18 +26,6 @@ pygtk.require('2.0')
import gtk import gtk
import gobject import gobject
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
rewrite = { 'general' : 'General', 'supported_databases' : 'Databases' rewrite = { 'general' : 'General', 'supported_databases' : 'Databases'

View File

@ -339,7 +339,7 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats):
#end def createStatsTable #end def createStatsTable
def reset_style_render_func(self, treeviewcolumn, cell, model, iter): def reset_style_render_func(self, treeviewcolumn, cell, model, iter):
cell.set_property('foreground', 'black') cell.set_property('foreground', None)
#end def reset_style_render_func #end def reset_style_render_func
def ledger_style_render_func(self, tvcol, cell, model, iter): def ledger_style_render_func(self, tvcol, cell, model, iter):

View File

@ -434,7 +434,7 @@ class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats):
#end def refreshStats #end def refreshStats
def reset_style_render_func(self, treeviewcolumn, cell, model, iter): def reset_style_render_func(self, treeviewcolumn, cell, model, iter):
cell.set_property('foreground', 'black') cell.set_property('foreground', None)
#end def reset_style_render_func #end def reset_style_render_func
def sortCols(self, col, nums): def sortCols(self, col, nums):

View File

@ -23,6 +23,9 @@
Main for FreePokerTools HUD. Main for FreePokerTools HUD.
""" """
import L10n
_ = L10n.get_translation()
# Standard Library modules # Standard Library modules
import sys import sys
import os import os
@ -51,21 +54,6 @@ elif sys.platform == 'darwin':
else: # This is bad--figure out the values for the various windows flavors else: # This is bad--figure out the values for the various windows flavors
import WinTables as Tables import WinTables as Tables
import locale
lang = locale.getdefaultlocale()[0][0:2]
print "lang:", lang
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
# get config and set up logger # get config and set up logger
c = Configuration.Config(file=options.config, dbname=options.dbname) c = Configuration.Config(file=options.config, dbname=options.dbname)
log = Configuration.get_logger("logging.conf", "hud", log_dir=c.dir_log, log_file='HUD-log.txt') log = Configuration.get_logger("logging.conf", "hud", log_dir=c.dir_log, log_file='HUD-log.txt')

View File

@ -1140,7 +1140,7 @@ class DrawHand(Hand):
hhc.markStreets(self) hhc.markStreets(self)
# markStreets in Draw may match without dealing cards # markStreets in Draw may match without dealing cards
if self.streets['DEAL'] == None: if self.streets['DEAL'] == None:
raise FpdbParseError(_("DrawHand.__init__: street 'DEAL' is empty. Hand cancelled?")) raise FpdbParseError(_("DrawHand.__init__: street 'DEAL' is empty. Hand cancelled? '%s'" % self.handid))
hhc.readBlinds(self) hhc.readBlinds(self)
hhc.readAntes(self) hhc.readAntes(self)
hhc.readButton(self) hhc.readButton(self)

View File

@ -49,7 +49,7 @@ class OnGame(HandHistoryConverter):
} }
currencies = { u'\u20ac':'EUR', u'\xe2\x82\xac':'EUR', '$':'USD', '':'T$' } currencies = { u'\u20ac':'EUR', u'\xe2\x82\xac':'EUR', '$':'USD', '':'T$' }
limits = { 'NO_LIMIT':'nl', 'LIMIT':'fl'} limits = { 'NO_LIMIT':'nl', 'POT_LIMIT':'pl', 'LIMIT':'fl'}
games = { # base, category games = { # base, category
"TEXAS_HOLDEM" : ('hold','holdem'), "TEXAS_HOLDEM" : ('hold','holdem'),
@ -73,7 +73,7 @@ class OnGame(HandHistoryConverter):
Start\shand:\s(?P<DATETIME>.*) Start\shand:\s(?P<DATETIME>.*)
Table:\s(?P<TABLE>[-\'\w\s]+)\s\[\d+\]\s\( Table:\s(?P<TABLE>[-\'\w\s]+)\s\[\d+\]\s\(
( (
(?P<LIMIT>NO_LIMIT|Limit|LIMIT|Pot\sLimit)\s (?P<LIMIT>NO_LIMIT|Limit|LIMIT|Pot\sLimit|POT_LIMIT)\s
(?P<GAME>TEXAS_HOLDEM|OMAHA_HI|SEVEN_CARD_STUD|SEVEN_CARD_STUD_HI_LO|RAZZ|FIVE_CARD_DRAW)\s (?P<GAME>TEXAS_HOLDEM|OMAHA_HI|SEVEN_CARD_STUD|SEVEN_CARD_STUD_HI_LO|RAZZ|FIVE_CARD_DRAW)\s
(?P<CURRENCY>%(LS)s|)?(?P<SB>[.0-9]+)/ (?P<CURRENCY>%(LS)s|)?(?P<SB>[.0-9]+)/
(%(LS)s)?(?P<BB>[.0-9]+) (%(LS)s)?(?P<BB>[.0-9]+)
@ -140,6 +140,7 @@ class OnGame(HandHistoryConverter):
def readSupportedGames(self): def readSupportedGames(self):
return [ return [
["ring", "hold", "fl"], ["ring", "hold", "fl"],
["ring", "hold", "pl"],
["ring", "hold", "nl"], ["ring", "hold", "nl"],
["ring", "stud", "fl"], ["ring", "stud", "fl"],
["ring", "draw", "fl"], ["ring", "draw", "fl"],
@ -158,6 +159,7 @@ class OnGame(HandHistoryConverter):
raise FpdbParseError(_("Unable to recognise gametype from: '%s'") % tmp) raise FpdbParseError(_("Unable to recognise gametype from: '%s'") % tmp)
mg = m.groupdict() mg = m.groupdict()
#print "DEBUG: mg: %s" % mg
info['type'] = 'ring' info['type'] = 'ring'
if 'CURRENCY' in mg: if 'CURRENCY' in mg:
@ -314,9 +316,9 @@ class OnGame(HandHistoryConverter):
m = self.re_Action.finditer(hand.streets[street]) m = self.re_Action.finditer(hand.streets[street])
for action in m: for action in m:
#acts = action.groupdict() #acts = action.groupdict()
#log.debug("readaction: acts: %s" %acts) #print "readaction: acts: %s" %acts
if action.group('ATYPE') == ' raises': 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': elif action.group('ATYPE') == ' calls':
hand.addCall( street, action.group('PNAME'), action.group('BET') ) hand.addCall( street, action.group('PNAME'), action.group('BET') )
elif action.group('ATYPE') == ' bets': elif action.group('ATYPE') == ' bets':

View File

@ -49,7 +49,8 @@ class PartyPoker(HandHistoryConverter):
currencies = {"\$": "USD", "$": "USD", u"\xe2\x82\xac": "EUR", u"\u20ac": "EUR", '': "T$"} currencies = {"\$": "USD", "$": "USD", u"\xe2\x82\xac": "EUR", u"\u20ac": "EUR", '': "T$"}
substitutions = { substitutions = {
'LEGAL_ISO' : "USD|EUR", # legal ISO currency codes 'LEGAL_ISO' : "USD|EUR", # legal ISO currency codes
'LS' : "\$|\u20AC|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8) 'LS' : u"\$|\u20ac|\xe2\x82\xac|", # Currency symbols - Euro(cp1252, utf-8)
'NUM' : u".,\d",
} }
# Static regexes # Static regexes
@ -81,7 +82,7 @@ class PartyPoker(HandHistoryConverter):
re_PlayerInfo = re.compile(u""" re_PlayerInfo = re.compile(u"""
Seat\s(?P<SEAT>\d+):\s Seat\s(?P<SEAT>\d+):\s
(?P<PNAME>.*)\s (?P<PNAME>.*)\s
\(\s*[%(LS)s]?(?P<CASH>[0-9,.]+)\s*(?:%(LEGAL_ISO)s|)\s*\) \(\s*[%(LS)s]?(?P<CASH>[%(NUM)s]+)\s*(?:%(LEGAL_ISO)s|)\s*\)
""" % substitutions, re.VERBOSE| re.UNICODE) """ % substitutions, re.VERBOSE| re.UNICODE)
re_HandInfo = re.compile(""" re_HandInfo = re.compile("""

View File

@ -84,8 +84,8 @@ class PokerStars(HandHistoryConverter):
# Static regexes # Static regexes
re_GameInfo = re.compile(u""" re_GameInfo = re.compile(u"""
PokerStars\sGame\s\#(?P<HID>[0-9]+):\s+ PokerStars(\sHome)?\sGame\s\#(?P<HID>[0-9]+):\s+
(Tournament\s\# # open paren of tournament info (\{.*\}\s+)?(Tournament\s\# # open paren of tournament info
(?P<TOURNO>\d+),\s (?P<TOURNO>\d+),\s
# here's how I plan to use LS # here's how I plan to use LS
(?P<BUYIN>(?P<BIAMT>[%(LS)s\d\.]+)?\+?(?P<BIRAKE>[%(LS)s\d\.]+)?\+?(?P<BOUNTY>[%(LS)s\d\.]+)?\s?(?P<TOUR_ISO>%(LEGAL_ISO)s)?|Freeroll)\s+)? (?P<BUYIN>(?P<BIAMT>[%(LS)s\d\.]+)?\+?(?P<BIRAKE>[%(LS)s\d\.]+)?\+?(?P<BOUNTY>[%(LS)s\d\.]+)?\s?(?P<TOUR_ISO>%(LEGAL_ISO)s)?|Freeroll)\s+)?

View File

@ -109,9 +109,9 @@ class RushNotes(Aux_Window):
notepath = site_params_dict['site_path'] # this is a temporary hijack of site-path notepath = site_params_dict['site_path'] # this is a temporary hijack of site-path
self.heroid = self.hud.db_connection.get_player_id(self.config, sitename, heroname) self.heroid = self.hud.db_connection.get_player_id(self.config, sitename, heroname)
self.notefile = notepath + "/" + heroname + ".xml" self.notefile = notepath + "/" + heroname + ".xml"
self.rushtables = ("Mach 10", "Lightning", "Celerity", "Flash", "Zoom") self.rushtables = ("Mach 10", "Lightning", "Celerity", "Flash", "Zoom", "Apollo")
if not os.path.isfile(self.notefile): if not (os.path.isfile(self.notefile)):
self.active = False self.active = False
return return
else: else:
@ -130,29 +130,34 @@ class RushNotes(Aux_Window):
xmlnotefile.unlink xmlnotefile.unlink
# #
# Create a fresh queue file with skeleton XML # if queue file does not exist create a fresh queue file with skeleton XML
# This is possibly not totally safe, if multiple threads arrive
# here at the same time, but the consequences are not serious
# #
self.queuefile = self.notefile + ".queue" self.queuefile = self.notefile + ".queue"
queuedom = minidom.Document() if not (os.path.isfile(self.queuefile)):
pld=queuedom.createElement("PLAYERDATA") queuedom = minidom.Document()
queuedom.appendChild(pld)
nts=queuedom.createElement("NOTES") pld=queuedom.createElement("PLAYERDATA")
pld.appendChild(nts) queuedom.appendChild(pld)
nte = queuedom.createElement("NOTE") nts=queuedom.createElement("NOTES")
nte = queuedom.createTextNode("\n") pld.appendChild(nts)
nts.insertBefore(nte,None)
outputfile = open(self.queuefile, 'w') nte = queuedom.createElement("NOTE")
queuedom.writexml(outputfile) nte = queuedom.createTextNode("\n")
outputfile.close() nts.insertBefore(nte,None)
queuedom.unlink
outputfile = open(self.queuefile, 'w')
queuedom.writexml(outputfile)
outputfile.close()
queuedom.unlink
if (debugmode): if (debugmode):
#initialise logfiles #initialise logfiles
debugfile=open("~Rushdebug.init", "w") debugfile=open("~Rushdebug.init", "a")
debugfile.write("conf="+str(config)+"\n") debugfile.write("conf="+str(config)+"\n")
debugfile.write("spdi="+str(site_params_dict)+"\n") debugfile.write("spdi="+str(site_params_dict)+"\n")
debugfile.write("para="+str(params)+"\n") debugfile.write("para="+str(params)+"\n")
@ -161,8 +166,6 @@ class RushNotes(Aux_Window):
debugfile.write("queu="+self.queuefile+"\n") debugfile.write("queu="+self.queuefile+"\n")
debugfile.close() debugfile.close()
open("~Rushdebug.data", "w").close()
def update_data(self, new_hand_id, db_connection): def update_data(self, new_hand_id, db_connection):
#this method called once for every hand processed #this method called once for every hand processed
@ -204,16 +207,19 @@ class RushNotes(Aux_Window):
vpip=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'vpip')[3] + " ") vpip=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'vpip')[3] + " ")
pfr=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'pfr')[3] + " ") pfr=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'pfr')[3] + " ")
three_B=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'three_B')[3] + " ") three_B=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'three_B')[3] + " ")
four_B=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'four_B')[3] + " ")
cbet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'cbet')[3] + " ") cbet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'cbet')[3] + " ")
fbbsteal=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_BB_steal')[3] + " ") fbbsteal=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_BB_steal')[3] + " ")
f_3bet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_3bet')[3] + " ")
f_4bet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_4bet')[3] + " ")
steal=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'steal')[3] + " ") steal=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'steal')[3] + " ")
ffreq1=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'ffreq1')[3] + " ") ffreq1=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'ffreq1')[3] + " ")
agg_freq=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'agg_freq')[3] + " ") agg_freq=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'agg_freq')[3] + " ")
BBper100=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'BBper100')[3]) BBper100=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'BBper100')[3])
if BBper100[6] == "-": BBper100=BBper100[0:6] + "(" + BBper100[7:] + ")" if BBper100[6] == "-": BBper100=BBper100[0:6] + "(" + BBper100[7:] + ")"
# #
# grab villain known starting hands # grab villain known starting hands
# only those where they VPIP'd, so limp in the BB will not be shown # only those where they VPIP'd, so limp in the BB will not be shown
@ -269,10 +275,13 @@ class RushNotes(Aux_Window):
# for later search/replace by Merge module # for later search/replace by Merge module
# #
xmlqueuedict[playername] = ("~fpdb~" + "\n" + xmlqueuedict[playername] = ("~fpdb~" + "\n" +
n + vpip + pfr + three_B + fbbsteal + "\n" + n + vpip + pfr + "\n" +
steal + cbet + ffreq1 + "\n" + steal + cbet + fbbsteal + ffreq1 + "\n" +
three_B + four_B + f_3bet + f_4bet + "\n" +
agg_freq + BBper100 + "\n" + agg_freq + BBper100 + "\n" +
PFcall+"\n"+PFaggr+"\n"+PFdefend +"\n" PFcall+"\n"+
PFaggr+"\n"+
PFdefend +"\n"+
"~ends~") "~ends~")
if (debugmode): if (debugmode):

View File

@ -105,8 +105,6 @@ if not os.path.isfile(sys.argv[1]):
if not os.path.isfile((sys.argv[1]+".queue")): if not os.path.isfile((sys.argv[1]+".queue")):
print "Nothing found to merge, quitting" print "Nothing found to merge, quitting"
print "Did the HUD not get started during the last session?"
print "Has the HUD been stopped and started without merging?"
quit() quit()
print "***************************************************************" print "***************************************************************"
@ -117,7 +115,7 @@ print "has stopped completely"
print "***************************************************************" print "***************************************************************"
print print
print "read from: ", sys.argv[1] print "read from: ", sys.argv[1]
print "merge with: ", sys.argv[1]+".queue" print "updated with: ", sys.argv[1]+".queue"
#read queue and turn into a dict #read queue and turn into a dict
queuedict = {} queuedict = {}
@ -172,7 +170,7 @@ mergednotes.close()
xmlnotefile.unlink xmlnotefile.unlink
print "Merged file has been written to: ", sys.argv[1]+".merged" print "written to: ", sys.argv[1]+".merged"
print "" print ""
print "number in queue: ", statqueue print "number in queue: ", statqueue
print "existing players updated: ", statupdated print "existing players updated: ", statupdated
@ -180,5 +178,7 @@ print "new players added: ", statadded
print "\n" print "\n"
print "Use a viewer to check the contents of the merge file." print "Use a viewer to check the contents of the merge file."
print "If you are happy, carry out the following steps:" print "If you are happy, carry out the following steps:"
print "1 Rename or delete the existing notes file (normally <heroname>.xml" print "1 Rename or delete the existing notes file (normally <heroname>.xml)"
print "2 Rename the .merged file to become the new notes file" print "2 Rename the .merged file to become the new notes file"
print "3 Delete the .queue file (it will be created at the next rush autoimport)"

View File

@ -15,11 +15,6 @@ Important info:
The Merge process can only be run when ftp client is shutdown The Merge process can only be run when ftp client is shutdown
- otherwise ftp overwrites the xml on exit. - otherwise ftp overwrites the xml on exit.
Restarting the autoimport will empty the notes"queue" so avoid restarting
autoimport until the previous notes "queue" has been merged. You will
lose all the queued notes, but these will be regenerated the next time
the villian is at your table, so it isn't the end of the world.
Existing ftp notes _SHOULD_ be preserved, but this isn't guaranteed, Existing ftp notes _SHOULD_ be preserved, but this isn't guaranteed,
you have been warned! you have been warned!
@ -27,7 +22,8 @@ Existing colour codings should be preserved,
this process does not change or set colourcodings. this process does not change or set colourcodings.
Copies of the live ftp notes file should be preserved everytime Copies of the live ftp notes file should be preserved everytime
RushNotesAux (i.e. the HUD is started) RushNotesAux (i.e. the HUD is started). If you play at different
rush tables, the backup will be created several times.
The AW is hard-coded with just the table names of Micro Rush Poker, The AW is hard-coded with just the table names of Micro Rush Poker,
and should ignore all other hands. and should ignore all other hands.
@ -35,7 +31,7 @@ The AW is hard-coded with just the table names of Micro Rush Poker,
What might not work? What might not work?
-------------------- --------------------
This isn't tested with Windows, and probably won't work, feedback welcome. This should work with windows sourcecode version, but will not work with the exe download.
Hasn't been tested for co-existance with other sites, feedback welcome. Hasn't been tested for co-existance with other sites, feedback welcome.
Whenever FTP change their notes file format, this will all break rather spectacularly, Whenever FTP change their notes file format, this will all break rather spectacularly,
you have been warned! you have been warned!
@ -77,7 +73,7 @@ execute the following:
./pyfpdb/RushNotesMerge.py "/home/foo/.wine/drive_c/Program Files/Full Tilt Poker/myname.xml" ./pyfpdb/RushNotesMerge.py "/home/foo/.wine/drive_c/Program Files/Full Tilt Poker/myname.xml"
A revised notes file (blah.merge) should automagically appear in the full tilt root directory. A revised notes file (blah.merge) should automagically appear in the full tilt root directory.
If you are happy with it, replace the existing (myname.xml file) If you are happy with it, replace the existing (myname.xml file) and delete the .queue file.
Since the updates aren't real time, it would be ok to play the rush Since the updates aren't real time, it would be ok to play the rush
@ -176,7 +172,7 @@ Process overview
---------------- ----------------
1/ The HUD process is started. 1/ The HUD process is started.
1.1/ when the first hand is received, h fresh holding file is created, and 1.1/ when the first hand is received, a queue file is created if not already there, and
a copy of the current live xml note file is created as a security backup. a copy of the current live xml note file is created as a security backup.
2/ For every hand played, the auxillary window is called 2/ For every hand played, the auxillary window is called
3/ Based upon the players in the hand, fpdb will be interrogated 3/ Based upon the players in the hand, fpdb will be interrogated
@ -191,4 +187,4 @@ existing notes, but this cannot be guaranteed.
they replace the existing note file. they replace the existing note file.
9/ Note that this process never updates the live notes file in situ, but 9/ Note that this process never updates the live notes file in situ, but
there is a risk that something goes wrong, and that existing notes could be destroyed. there is a risk that something goes wrong, and that existing notes could be destroyed.
10/ the queue file can be deleted to reduce re-processing next time.

View File

@ -1511,10 +1511,10 @@ class Sql:
sum(hc.HDs) AS n, sum(hc.HDs) AS n,
sum(hc.street0VPI) AS vpip, sum(hc.street0VPI) AS vpip,
sum(hc.street0Aggr) AS pfr, sum(hc.street0Aggr) AS pfr,
sum(hc.street0_3BChance) AS 3B_opp_0, sum(hc.street0_3BChance) AS TB_opp_0,
sum(hc.street0_3BDone) AS 3B_0, sum(hc.street0_3BDone) AS TB_0,
sum(hc.street0_4BChance) AS 4B_opp_0, sum(hc.street0_4BChance) AS FB_opp_0,
sum(hc.street0_4BDone) AS 4B_0, sum(hc.street0_4BDone) AS FB_0,
sum(hc.street0_FoldTo3BChance) AS F3B_opp_0, sum(hc.street0_FoldTo3BChance) AS F3B_opp_0,
sum(hc.street0_FoldTo3BDone) AS F3B_0, sum(hc.street0_FoldTo3BDone) AS F3B_0,
sum(hc.street0_FoldTo4BChance) AS F4B_opp_0, sum(hc.street0_FoldTo4BChance) AS F4B_opp_0,
@ -1628,10 +1628,10 @@ class Sql:
sum(hc.HDs) AS n, sum(hc.HDs) AS n,
sum(hc.street0VPI) AS vpip, sum(hc.street0VPI) AS vpip,
sum(hc.street0Aggr) AS pfr, sum(hc.street0Aggr) AS pfr,
sum(hc.street0_3BChance) AS 3B_opp_0, sum(hc.street0_3BChance) AS TB_opp_0,
sum(hc.street0_3BDone) AS 3B_0, sum(hc.street0_3BDone) AS TB_0,
sum(hc.street0_4BChance) AS 4B_opp_0, sum(hc.street0_4BChance) AS FB_opp_0,
sum(hc.street0_4BDone) AS 4B_0, sum(hc.street0_4BDone) AS FB_0,
sum(hc.street0_FoldTo3BChance) AS F3B_opp_0, sum(hc.street0_FoldTo3BChance) AS F3B_opp_0,
sum(hc.street0_FoldTo3BDone) AS F3B_0, sum(hc.street0_FoldTo3BDone) AS F3B_0,
sum(hc.street0_FoldTo4BChance) AS F4B_opp_0, sum(hc.street0_FoldTo4BChance) AS F4B_opp_0,
@ -1762,10 +1762,10 @@ class Sql:
1 AS n, 1 AS n,
cast(hp2.street0VPI as <signed>integer) AS vpip, cast(hp2.street0VPI as <signed>integer) AS vpip,
cast(hp2.street0Aggr as <signed>integer) AS pfr, cast(hp2.street0Aggr as <signed>integer) AS pfr,
cast(hp2.street0_3BChance as <signed>integer) AS 3B_opp_0, cast(hp2.street0_3BChance as <signed>integer) AS TB_opp_0,
cast(hp2.street0_3BDone as <signed>integer) AS 3B_0, cast(hp2.street0_3BDone as <signed>integer) AS TB_0,
cast(hp2.street0_4BChance as <signed>integer) AS 4B_opp_0, cast(hp2.street0_4BChance as <signed>integer) AS FB_opp_0,
cast(hp2.street0_4BDone as <signed>integer) AS 4B_0, cast(hp2.street0_4BDone as <signed>integer) AS FB_0,
cast(hp2.street0_FoldTo3BChance as <signed>integer) AS F3B_opp_0, cast(hp2.street0_FoldTo3BChance as <signed>integer) AS F3B_opp_0,
cast(hp2.street0_FoldTo3BDone as <signed>integer) AS F3B_0, cast(hp2.street0_FoldTo3BDone as <signed>integer) AS F3B_0,
cast(hp2.street0_FoldTo4BChance as <signed>integer) AS F4B_opp_0, cast(hp2.street0_FoldTo4BChance as <signed>integer) AS F4B_opp_0,
@ -1872,14 +1872,14 @@ class Sql:
1 AS n, 1 AS n,
cast(hp2.street0VPI as <signed>integer) AS vpip, cast(hp2.street0VPI as <signed>integer) AS vpip,
cast(hp2.street0Aggr as <signed>integer) AS pfr, cast(hp2.street0Aggr as <signed>integer) AS pfr,
cast(hp2.street0_3BChance as <signed>integer) AS 3B_opp_0, cast(hp2.street0_3BChance as <signed>integer) AS TB_opp_0,
cast(hp2.street0_3BDone as <signed>integer) AS 3B_0, cast(hp2.street0_3BDone as <signed>integer) AS TB_0,
cast(hp2.street0_4BChance as <signed>integer) AS 4B_opp_0, cast(hp2.street0_4BChance as <signed>integer) AS FB_opp_0,
cast(hp2.street0_4BDone as <signed>integer) AS 4B_0, cast(hp2.street0_4BDone as <signed>integer) AS FB_0,
cast(hp2.street0_FoldTo3BChance as <signed>integer) AS 3TB_opp_0, cast(hp2.street0_FoldTo3BChance as <signed>integer) AS TTB_opp_0,
cast(hp2.street0_FoldTo3BDone as <signed>integer) AS 3TB_0, cast(hp2.street0_FoldTo3BDone as <signed>integer) AS TTB_0,
cast(hp2.street0_FoldTo4BChance as <signed>integer) AS 4TB_opp_0, cast(hp2.street0_FoldTo4BChance as <signed>integer) AS FTB_opp_0,
cast(hp2.street0_FoldTo4BDone as <signed>integer) AS 4TB_0, cast(hp2.street0_FoldTo4BDone as <signed>integer) AS FTB_0,
cast(hp2.street1Seen as <signed>integer) AS saw_f, cast(hp2.street1Seen as <signed>integer) AS saw_f,
cast(hp2.street1Seen as <signed>integer) AS saw_1, cast(hp2.street1Seen as <signed>integer) AS saw_1,
cast(hp2.street2Seen as <signed>integer) AS saw_2, cast(hp2.street2Seen as <signed>integer) AS saw_2,
@ -1983,14 +1983,14 @@ class Sql:
1 AS n, 1 AS n,
cast(hp2.street0VPI as <signed>integer) AS vpip, cast(hp2.street0VPI as <signed>integer) AS vpip,
cast(hp2.street0Aggr as <signed>integer) AS pfr, cast(hp2.street0Aggr as <signed>integer) AS pfr,
cast(hp2.street0_3BChance as <signed>integer) AS 3B_opp_0, cast(hp2.street0_3BChance as <signed>integer) AS TB_opp_0,
cast(hp2.street0_3BDone as <signed>integer) AS 3B_0, cast(hp2.street0_3BDone as <signed>integer) AS TB_0,
cast(hp2.street0_4BChance as <signed>integer) AS 4B_opp_0, cast(hp2.street0_4BChance as <signed>integer) AS FB_opp_0,
cast(hp2.street0_4BDone as <signed>integer) AS 4B_0, cast(hp2.street0_4BDone as <signed>integer) AS FB_0,
cast(hp2.street0_FoldTo3BChance as <signed>integer) AS F3B_opp_0, cast(hp2.street0_FoldTo3BChance as <signed>integer) AS TB_opp_0,
cast(hp2.street0_FoldTo3BDone as <signed>integer) AS F3B_0, cast(hp2.street0_FoldTo3BDone as <signed>integer) AS TB_0,
cast(hp2.street0_FoldTo4BChance as <signed>integer) AS F4B_opp_0, cast(hp2.street0_FoldTo4BChance as <signed>integer) AS FB_opp_0,
cast(hp2.street0_FoldTo4BDone as <signed>integer) AS F4B_0, cast(hp2.street0_FoldTo4BDone as <signed>integer) AS FB_0,
cast(hp2.street1Seen as <signed>integer) AS saw_f, cast(hp2.street1Seen as <signed>integer) AS saw_f,
cast(hp2.street1Seen as <signed>integer) AS saw_1, cast(hp2.street1Seen as <signed>integer) AS saw_1,
cast(hp2.street2Seen as <signed>integer) AS saw_2, cast(hp2.street2Seen as <signed>integer) AS saw_2,
@ -2294,7 +2294,7 @@ class Sql:
end AS pofafq end AS pofafq
,case when sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)) = 0 then -999 ,case when sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)) = 0 then -999
else (sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer))) else (sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer)))
/(sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer))) /(0.0+sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)))
end AS aggfac end AS aggfac
,100.0*(sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer))) ,100.0*(sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer)))
/ ((sum(cast(hp.foldToOtherRaisedStreet1 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as <signed>integer))) + / ((sum(cast(hp.foldToOtherRaisedStreet1 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as <signed>integer))) +
@ -2415,7 +2415,7 @@ class Sql:
end AS pofafq end AS pofafq
,case when sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)) = 0 then -999 ,case when sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)) = 0 then -999
else (sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer))) else (sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer)))
/(sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer))) /(0.0+sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)))
end AS aggfac end AS aggfac
,100.0*(sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer))) ,100.0*(sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer)))
/ ((sum(cast(hp.foldToOtherRaisedStreet1 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as <signed>integer))) + / ((sum(cast(hp.foldToOtherRaisedStreet1 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as <signed>integer))) +
@ -2537,7 +2537,7 @@ class Sql:
end AS pofafq end AS pofafq
,case when sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)) = 0 then -999 ,case when sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)) = 0 then -999
else (sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer))) else (sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer)))
/(sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer))) /(0.0+sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)))
end AS aggfac end AS aggfac
,100.0*(sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer))) ,100.0*(sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer)))
/ ((sum(cast(hp.foldToOtherRaisedStreet1 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as <signed>integer))) + / ((sum(cast(hp.foldToOtherRaisedStreet1 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as <signed>integer))) +

View File

@ -442,12 +442,12 @@ def three_B(stat_dict, player):
""" Three bet preflop/3rd.""" """ Three bet preflop/3rd."""
stat = 0.0 stat = 0.0
try: try:
stat = float(stat_dict[player]['3b_0'])/float(stat_dict[player]['3b_opp_0']) stat = float(stat_dict[player]['3b_0'])/float(stat_dict[player]['Tb_opp_0'])
return (stat, return (stat,
'%3.1f' % (100.0*stat), '%3.1f' % (100.0*stat),
'3B=%3.1f%%' % (100.0*stat), '3B=%3.1f%%' % (100.0*stat),
'3B_pf=%3.1f%%' % (100.0*stat), '3B_pf=%3.1f%%' % (100.0*stat),
'(%d/%d)' % (stat_dict[player]['3b_0'], stat_dict[player]['3b_opp_0']), '(%d/%d)' % (stat_dict[player]['3b_0'], stat_dict[player]['Tb_opp_0']),
_('% 4 Bet preflop/3rd')) _('% 4 Bet preflop/3rd'))
except: except:
return (stat, return (stat,
@ -461,12 +461,12 @@ def four_B(stat_dict, player):
""" Four bet preflop/4rd.""" """ Four bet preflop/4rd."""
stat = 0.0 stat = 0.0
try: try:
stat = float(stat_dict[player]['4b_0'])/float(stat_dict[player]['4b_opp_0']) stat = float(stat_dict[player]['4b_0'])/float(stat_dict[player]['Fb_opp_0'])
return (stat, return (stat,
'%3.1f' % (100.0*stat), '%3.1f' % (100.0*stat),
'4B=%3.1f%%' % (100.0*stat), '4B=%3.1f%%' % (100.0*stat),
'4B_pf=%3.1f%%' % (100.0*stat), '4B_pf=%3.1f%%' % (100.0*stat),
'(%d/%d)' % (stat_dict[player]['4b_0'], stat_dict[player]['4b_opp_0']), '(%d/%d)' % (stat_dict[player]['Fb_0'], stat_dict[player]['Fb_opp_0']),
_('% 4 Bet preflop/4rd')) _('% 4 Bet preflop/4rd'))
except: except:
return (stat, return (stat,

View File

@ -15,10 +15,13 @@ import L10n
_ = L10n.get_translation() _ = L10n.get_translation()
import sys, random import sys, random
import re
import pokereval import pokereval
SUITS = ['h', 'd', 's', 'c'] SUITS = ['h', 'd', 's', 'c']
CONNECTORS = ['32', '43', '54', '65', '76', '87', '98', 'T9', 'JT', 'QJ', 'KQ', 'AK']
ANY = 0 ANY = 0
SUITED = 1 SUITED = 1
OFFSUIT = 2 OFFSUIT = 2
@ -65,14 +68,7 @@ class Stove:
hands_in_range = string.strip().split(',') hands_in_range = string.strip().split(',')
for h in hands_in_range: for h in hands_in_range:
_h = h.strip() _h = h.strip()
if len(_h) > 3: h_range.expand(expand_hands(_h, self.hand, self.board))
cc = _h.split()
r1 = cc[0]
r2 = cc[1]
vp = Cards(r1, r2)
h_range.add(vp)
else:
h_range.expand(expand_hands(_h, self.hand, self.board))
self.h_range = h_range self.h_range = h_range
@ -83,7 +79,7 @@ class Cards:
self.c2 = c2 self.c2 = c2
def get(self): def get(self):
return [c1, c2] return [self.c1, self.c2]
class Board: class Board:
def __init__(self, b1=None, b2=None, b3=None, b4=None, b5=None): def __init__(self, b1=None, b2=None, b3=None, b4=None, b5=None):
@ -127,7 +123,7 @@ class Range:
def get(self): def get(self):
return sorted(self.__hands) return sorted(self.__hands)
class EV: class EV:
def __init__(self, plays, win, tie, lose): def __init__(self, plays, win, tie, lose):
@ -175,6 +171,35 @@ def expand_hands(abbrev, hand, board):
known_cards.update(set([hand.c2, hand.c2])) known_cards.update(set([hand.c2, hand.c2]))
known_cards.update(set([board.b1, board.b2, board.b3, board.b4, board.b5])) known_cards.update(set([board.b1, board.b2, board.b3, board.b4, board.b5]))
re.search('[2-9TJQKA]{2}(s|o)',abbrev)
if re.search('^[2-9TJQKA]{2}(s|o)$',abbrev): #AKs or AKo
return standard_expand(abbrev, hand, known_cards)
elif re.search('^[2-9TJQKA]{2}(s|o)\+$',abbrev): #76s+ or 76o+
return iterative_expand(abbrev, hand, known_cards)
#elif: AhXh
#elif: Ah6h+A
def iterative_expand(abbrev, hand, known_cards):
r1 = abbrev[0]
r2 = abbrev[1]
h_range = []
considered = set()
idx = CONNECTORS.index('%s%s' % (r1, r2))
ltr = abbrev[2]
h_range = []
for h in CONNECTORS[idx:]:
abr = "%s%s" % (h, ltr)
h_range += standard_expand(abr, hand, known_cards)
return h_range
def standard_expand(abbrev, hand, known_cards):
# Card ranks may be different # Card ranks may be different
r1 = abbrev[0] r1 = abbrev[0]
r2 = abbrev[1] r2 = abbrev[1]
@ -228,7 +253,7 @@ def odds_for_hand(hand1, hand2, board, iterations):
board = board, board = board,
iterations = iterations iterations = iterations
) )
plays = int(res['info'][0]) plays = int(res['info'][0])
eval = res['eval'][0] eval = res['eval'][0]

View File

@ -107,6 +107,7 @@ class Winamax(HandHistoryConverter):
re_TailSplitHands = re.compile(r'\n\s*\n') re_TailSplitHands = re.compile(r'\n\s*\n')
re_Button = re.compile(r'Seat\s#(?P<BUTTON>\d+)\sis\sthe\sbutton') re_Button = re.compile(r'Seat\s#(?P<BUTTON>\d+)\sis\sthe\sbutton')
re_Board = re.compile(r"\[(?P<CARDS>.+)\]") re_Board = re.compile(r"\[(?P<CARDS>.+)\]")
re_Total = re.compile(r"Total pot (?P<TOTAL>[\.\d]+).*(No rake|Rake (?P<RAKE>[\.\d]+))" % substitutions)
# 2010/09/21 03:10:51 UTC # 2010/09/21 03:10:51 UTC
re_DateTime = re.compile(""" re_DateTime = re.compile("""
@ -219,13 +220,15 @@ class Winamax(HandHistoryConverter):
# TODO: Manually adjust time against OFFSET # TODO: Manually adjust time against OFFSET
hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET" hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET"
hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, "CET", "UTC") hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, "CET", "UTC")
# if key == 'HID1': if key == 'HID1':
# # Need to remove non-alphanumerics for MySQL # Need to remove non-alphanumerics for MySQL
# hand.handid = "1%.9d%s%s"%(int(info['HID2']),info['HID1'],info['HID3']) # hand.handid = "1%.9d%s%s"%(int(info['HID2']),info['HID1'],info['HID3'])
# if len (hand.handid) > 19: hand.handid = "%s%s%s"%(int(info['HID2']),info['HID1'],info['HID3'])
# hand.handid = "%s" % info['HID1'] if len (hand.handid) > 19:
if key == 'HID3': hand.handid = "%s%s" % (int(info['HID2']), int(info['HID3']))
hand.handid = int(info['HID3']) # correct hand no (REB)
# if key == 'HID3':
# hand.handid = int(info['HID3']) # correct hand no (REB)
if key == 'TOURNO': if key == 'TOURNO':
hand.tourNo = info[key] hand.tourNo = info[key]
if key == 'TABLE': if key == 'TABLE':
@ -434,15 +437,29 @@ class Winamax(HandHistoryConverter):
collectees = [] collectees = []
tp = self.re_Total.search(hand.handText)
rake = tp.group('RAKE')
if rake == None:
rake = 0
for m in self.re_CollectPot.finditer(hand.handText): for m in self.re_CollectPot.finditer(hand.handText):
collectees.append([m.group('PNAME'), m.group('POT')]) collectees.append([m.group('PNAME'), m.group('POT')])
for plyr, p in collectees: if len(collectees) == 1:
if plyr in returned.keys() and Decimal(p) - returned[plyr] == 0: #print "DEBUG: Total pot: %s" % tp.groupdict()
p = Decimal(p) - returned[plyr] #print "DEBUG: According to pot: %s" % total
if p > 0: #print "DEBUG: Rake: %s" % rake
print "DEBUG: addCollectPot(%s,%s)" %(plyr, p) plyr, p = collectees[0]
hand.addCollectPot(player=plyr,pot=p) # p may be wrong, use calculated total - rake
p = total - Decimal(rake)
#print "DEBUG: len1: addCollectPot(%s,%s)" %(plyr, p)
hand.addCollectPot(player=plyr,pot=p)
else:
for plyr, p in collectees:
if plyr in returned.keys() and Decimal(p) - returned[plyr] == 0:
p = Decimal(p) - returned[plyr]
if p > 0:
#print "DEBUG: addCollectPot(%s,%s)" %(plyr, p)
hand.addCollectPot(player=plyr,pot=p)
def readShownCards(self,hand): def readShownCards(self,hand):
for m in self.re_ShownCards.finditer(hand.handText): for m in self.re_ShownCards.finditer(hand.handText):

View File

@ -49,7 +49,7 @@
'street0_4BDone': False, 'street0_4BDone': False,
'street0_FoldTo3BChance': False, 'street0_FoldTo3BChance': False,
'street0_FoldTo3BDone': False, 'street0_FoldTo3BDone': False,
'street0_FoldTo4BChance': False, 'street0_FoldTo4BChance': True,
'street0_FoldTo4BDone': False, 'street0_FoldTo4BDone': False,
'street1Aggr': False, 'street1Aggr': False,
'street1Bets': 0, 'street1Bets': 0,
@ -537,7 +537,7 @@
'street0_3BDone': False, 'street0_3BDone': False,
'street0_4BChance': True, 'street0_4BChance': True,
'street0_4BDone': True, 'street0_4BDone': True,
'street0_FoldTo3BChance': False, 'street0_FoldTo3BChance': True,
'street0_FoldTo3BDone': False, 'street0_FoldTo3BDone': False,
'street0_FoldTo4BChance': False, 'street0_FoldTo4BChance': False,
'street0_FoldTo4BDone': False, 'street0_FoldTo4BDone': False,

View File

@ -0,0 +1,16 @@
Full Tilt Poker Tournament Summary $2 + $0.25 Sit & Go (214900008) Hold'em No Limit
Buy-In: $2 + $0.25
Buy-In Chips: 1500
6 Entries
Total Prize Pool: $12
Tournament started: 2011/01/27 07:21:00 ET
Tournament finished: 2011/01/27 08:38:00 ET
1: Hero, $7.80
2: Player2, $4.20
3: Player3
4: Player4
5: Player5
6: Player6
Hero finished in 1st place

View File

@ -0,0 +1,18 @@
Full Tilt Poker Tournament Summary $2 + $0.25 Sit & Go (214976900) Hold'em No Limit
Buy-In: $2 + $0.25
Buy-In Chips: 1500
9 Entries
Total Prize Pool: $18
Tournament started: 2011/01/27 14:35:00 ET
Tournament finished: 2011/01/27 15:25:00 ET
1: Player1, $9
2: Player2, $5.40
3: Hero, $3.60
4: Player4
5: Player5
6: Player6
7: Player7
8: Player8
9: Player9
Hero finished in 3rd place