Merge branch 'sqlcoder'
This commit is contained in:
commit
4e01892fcb
|
@ -294,7 +294,7 @@ class GuiBulkImport():
|
||||||
self.cb_drophudcache.show()
|
self.cb_drophudcache.show()
|
||||||
|
|
||||||
# button - Import
|
# button - Import
|
||||||
self.load_button = gtk.Button(_('Import')) # todo: rename variables to import too
|
self.load_button = gtk.Button(_('_Bulk Import')) # todo: rename variables to import too
|
||||||
self.load_button.connect('clicked', self.load_clicked,
|
self.load_button.connect('clicked', self.load_clicked,
|
||||||
_('Import clicked'))
|
_('Import clicked'))
|
||||||
self.table.attach(self.load_button, 2, 3, 4, 5, xpadding=0, ypadding=0,
|
self.table.attach(self.load_button, 2, 3, 4, 5, xpadding=0, ypadding=0,
|
||||||
|
|
|
@ -70,6 +70,7 @@ class HandHistoryConverter():
|
||||||
# "utf_8" is more likely if there are funny characters
|
# "utf_8" is more likely if there are funny characters
|
||||||
codepage = "cp1252"
|
codepage = "cp1252"
|
||||||
|
|
||||||
|
re_tzOffset = re.compile('^\w+[+-]\d{4}$')
|
||||||
|
|
||||||
def __init__(self, config, in_path = '-', out_path = '-', follow=False, index=0, autostart=True, starsArchive=False, ftpArchive=False):
|
def __init__(self, config, in_path = '-', out_path = '-', follow=False, index=0, autostart=True, starsArchive=False, ftpArchive=False):
|
||||||
"""\
|
"""\
|
||||||
|
@ -150,6 +151,7 @@ Otherwise, finish at EOF.
|
||||||
log.debug(handText)
|
log.debug(handText)
|
||||||
else:
|
else:
|
||||||
handsList = self.allHandsAsList()
|
handsList = self.allHandsAsList()
|
||||||
|
log.debug( _("handsList is ") + str(handsList) )
|
||||||
log.info("Parsing %d hands" % len(handsList))
|
log.info("Parsing %d hands" % len(handsList))
|
||||||
# Determine if we're dealing with a HH file or a Summary file
|
# Determine if we're dealing with a HH file or a Summary file
|
||||||
# quick fix : empty files make the handsList[0] fail ==> If empty file, go on with HH parsing
|
# quick fix : empty files make the handsList[0] fail ==> If empty file, go on with HH parsing
|
||||||
|
@ -568,17 +570,32 @@ or None if we fail to get the info """
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def changeTimezone(time, givenTimezone, wantedTimezone):
|
def changeTimezone(time, givenTimezone, wantedTimezone):
|
||||||
#print "raw time:",time, "given TZ:", givenTimezone
|
"""Takes a givenTimezone in format AAA or AAA+HHMM where AAA is a standard timezone
|
||||||
|
and +HHMM is an optional offset (+/-) in hours (HH) and minutes (MM)
|
||||||
|
(See OnGameToFpdb.py for example use of the +HHMM part)
|
||||||
|
Tries to convert the time parameter (with no timezone) from the givenTimezone to
|
||||||
|
the wantedTimeZone (currently only allows "UTC")
|
||||||
|
"""
|
||||||
|
log.debug( _("raw time:")+str(time) + _(" given TZ:")+str(givenTimezone) )
|
||||||
if wantedTimezone=="UTC":
|
if wantedTimezone=="UTC":
|
||||||
wantedTimezone = pytz.utc
|
wantedTimezone = pytz.utc
|
||||||
else:
|
else:
|
||||||
raise Error #TODO raise appropriate error
|
raise Error #TODO raise appropriate error
|
||||||
|
|
||||||
|
givenTZ = None
|
||||||
|
if HandHistoryConverter.re_tzOffset.match(givenTimezone):
|
||||||
|
offset = int(givenTimezone[-5:])
|
||||||
|
givenTimezone = givenTimezone[0:-5]
|
||||||
|
log.debug( _("changeTimeZone: offset=") + str(offset) )
|
||||||
|
else: offset=0
|
||||||
|
|
||||||
if givenTimezone=="ET":
|
if givenTimezone=="ET":
|
||||||
givenTimezone = timezone('US/Eastern')
|
givenTZ = timezone('US/Eastern')
|
||||||
elif givenTimezone=="CET":
|
elif givenTimezone=="CET":
|
||||||
givenTimezone = timezone('Europe/Berlin')
|
givenTZ = timezone('Europe/Berlin')
|
||||||
#Note: Daylight Saving Time is standardised across the EU so this should be fine
|
#Note: Daylight Saving Time is standardised across the EU so this should be fine
|
||||||
|
elif givenTimezone == 'GMT': # Greenwich Mean Time (same as UTC - no change to time)
|
||||||
|
givenTZ = timezone('GMT')
|
||||||
elif givenTimezone == 'HST': # Hawaiian Standard Time
|
elif givenTimezone == 'HST': # Hawaiian Standard Time
|
||||||
pass
|
pass
|
||||||
elif givenTimezone == 'AKT': # Alaska Time
|
elif givenTimezone == 'AKT': # Alaska Time
|
||||||
|
@ -612,23 +629,27 @@ or None if we fail to get the info """
|
||||||
elif givenTimezone == 'JST': # Japan Standard Time
|
elif givenTimezone == 'JST': # Japan Standard Time
|
||||||
pass
|
pass
|
||||||
elif givenTimezone == 'AWST': # Australian Western Standard Time
|
elif givenTimezone == 'AWST': # Australian Western Standard Time
|
||||||
givenTimezone = timezone('Australia/West')
|
givenTZ = timezone('Australia/West')
|
||||||
elif givenTimezone == 'ACST': # Australian Central Standard Time
|
elif givenTimezone == 'ACST': # Australian Central Standard Time
|
||||||
givenTimezone = timezone('Australia/Darwin')
|
givenTZ = timezone('Australia/Darwin')
|
||||||
elif givenTimezone == 'AEST': # Australian Eastern Standard Time
|
elif givenTimezone == 'AEST': # Australian Eastern Standard Time
|
||||||
# Each State on the East Coast has different DSTs.
|
# Each State on the East Coast has different DSTs.
|
||||||
# Melbournce is out because I don't like AFL, Queensland doesn't have DST
|
# Melbournce is out because I don't like AFL, Queensland doesn't have DST
|
||||||
# ACT is full of politicians and Tasmania will never notice.
|
# ACT is full of politicians and Tasmania will never notice.
|
||||||
# Using Sydney.
|
# Using Sydney.
|
||||||
givenTimezone = timezone('Australia/Sydney')
|
givenTZ = timezone('Australia/Sydney')
|
||||||
elif givenTimezone == 'NZT': # New Zealand Time
|
elif givenTimezone == 'NZT': # New Zealand Time
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise Error #TODO raise appropriate error
|
raise Error #TODO raise appropriate error
|
||||||
|
|
||||||
localisedTime = givenTimezone.localize(time)
|
if givenTZ is None:
|
||||||
utcTime = localisedTime.astimezone(wantedTimezone)
|
raise Error #TODO raise appropriate error
|
||||||
#print "utcTime:",utcTime
|
# (or just return time unchanged?)
|
||||||
|
|
||||||
|
localisedTime = givenTZ.localize(time)
|
||||||
|
utcTime = localisedTime.astimezone(wantedTimezone) + datetime.timedelta(seconds=-3600*(offset/100)-60*(offset%100))
|
||||||
|
log.debug( _("utcTime:")+str(utcTime) )
|
||||||
return utcTime
|
return utcTime
|
||||||
#end @staticmethod def changeTimezone
|
#end @staticmethod def changeTimezone
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,8 @@ class OnGame(HandHistoryConverter):
|
||||||
codepage = ("utf8", "cp1252")
|
codepage = ("utf8", "cp1252")
|
||||||
siteId = 5 # Needs to match id entry in Sites database
|
siteId = 5 # Needs to match id entry in Sites database
|
||||||
|
|
||||||
|
mixes = { } # Legal mixed games
|
||||||
|
sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\xe2\x82\xac", "GBP": "\xa3"} # ADD Euro, Sterling, etc HERE
|
||||||
substitutions = {
|
substitutions = {
|
||||||
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
|
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
|
||||||
'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8)
|
'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8)
|
||||||
|
@ -65,7 +67,8 @@ class OnGame(HandHistoryConverter):
|
||||||
|
|
||||||
#self.rexx.setGameInfoRegex('.*Blinds \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)')
|
#self.rexx.setGameInfoRegex('.*Blinds \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)')
|
||||||
# Static regexes
|
# Static regexes
|
||||||
re_SplitHands = re.compile(r'End of hand .{2}-\d{7,9}-\d+ \*\*\*\*\*\n')
|
# ***** End of hand R5-75443872-57 *****
|
||||||
|
re_SplitHands = re.compile(u'\*\*\*\*\*\sEnd\sof\shand\s[-A-Z\d]+.*\n(?=\*)')
|
||||||
|
|
||||||
# ***** History for hand R5-75443872-57 *****
|
# ***** History for hand R5-75443872-57 *****
|
||||||
# Start hand: Wed Aug 18 19:29:10 GMT+0100 2010
|
# Start hand: Wed Aug 18 19:29:10 GMT+0100 2010
|
||||||
|
@ -73,7 +76,7 @@ class OnGame(HandHistoryConverter):
|
||||||
re_HandInfo = re.compile(u"""
|
re_HandInfo = re.compile(u"""
|
||||||
\*\*\*\*\*\sHistory\sfor\shand\s(?P<HID>[-A-Z\d]+).*
|
\*\*\*\*\*\sHistory\sfor\shand\s(?P<HID>[-A-Z\d]+).*
|
||||||
Start\shand:\s(?P<DATETIME>.*)
|
Start\shand:\s(?P<DATETIME>.*)
|
||||||
Table:\s(?P<TABLE>[\'\w]+)\s\[\d+\]\s\(
|
Table:\s(?P<TABLE>[\'\w\s]+)\s\[\d+\]\s\(
|
||||||
(
|
(
|
||||||
(?P<LIMIT>No\sLimit|Limit|LIMIT|Pot\sLimit)\s
|
(?P<LIMIT>No\sLimit|Limit|LIMIT|Pot\sLimit)\s
|
||||||
(?P<GAME>TEXAS_HOLDEM|RAZZ)\s
|
(?P<GAME>TEXAS_HOLDEM|RAZZ)\s
|
||||||
|
@ -82,20 +85,24 @@ class OnGame(HandHistoryConverter):
|
||||||
)?
|
)?
|
||||||
""" % substitutions, re.MULTILINE|re.DOTALL|re.VERBOSE)
|
""" % substitutions, re.MULTILINE|re.DOTALL|re.VERBOSE)
|
||||||
|
|
||||||
|
re_TailSplitHands = re.compile(u'(\*\*\*\*\*\sEnd\sof\shand\s[-A-Z\d]+.*\n)(?=\*)')
|
||||||
|
re_Button = re.compile('Button: seat (?P<BUTTON>\d+)', re.MULTILINE) # Button: seat 2
|
||||||
|
re_Board = re.compile(r"\[(?P<CARDS>.+)\]")
|
||||||
|
|
||||||
# Wed Aug 18 19:45:30 GMT+0100 2010
|
# Wed Aug 18 19:45:30 GMT+0100 2010
|
||||||
re_DateTime = re.compile("""
|
re_DateTime = re.compile("""
|
||||||
[a-zA-Z]{3}\s
|
[a-zA-Z]{3}\s
|
||||||
(?P<M>[a-zA-Z]{3})\s
|
(?P<M>[a-zA-Z]{3})\s
|
||||||
(?P<D>[0-9]{2})\s
|
(?P<D>[0-9]{2})\s
|
||||||
(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\sGMT
|
(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\s
|
||||||
(?P<OFFSET>[-+]\d+)\s
|
(?P<OFFSET>\w+[-+]\d+)\s
|
||||||
(?P<Y>[0-9]{4})
|
(?P<Y>[0-9]{4})
|
||||||
""", re.MULTILINE|re.VERBOSE)
|
""", re.MULTILINE|re.VERBOSE)
|
||||||
|
|
||||||
# self.rexx.button_re = re.compile('#SUMMARY\nDealer: (?P<BUTTONPNAME>.*)\n')
|
# self.rexx.button_re = re.compile('#SUMMARY\nDealer: (?P<BUTTONPNAME>.*)\n')
|
||||||
|
|
||||||
#Seat 1: .Lucchess ($4.17 in chips)
|
#Seat 1: .Lucchess ($4.17 in chips)
|
||||||
re_PlayerInfo = re.compile(u'Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \((?P<CASH>[.0-9]+) \)')
|
re_PlayerInfo = re.compile(u'Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \((?P<CASH>[.0-9]+)\)')
|
||||||
|
|
||||||
def compilePlayerRegexs(self, hand):
|
def compilePlayerRegexs(self, hand):
|
||||||
players = set([player[1] for player in hand.players])
|
players = set([player[1] for player in hand.players])
|
||||||
|
@ -104,29 +111,30 @@ class OnGame(HandHistoryConverter):
|
||||||
# TODO: should probably rename re_HeroCards and corresponding method,
|
# TODO: should probably rename re_HeroCards and corresponding method,
|
||||||
# since they are used to find all cards on lines starting with "Dealt to:"
|
# since they are used to find all cards on lines starting with "Dealt to:"
|
||||||
# They still identify the hero.
|
# They still identify the hero.
|
||||||
|
self.compiledPlayers = players
|
||||||
|
|
||||||
#ANTES/BLINDS
|
#ANTES/BLINDS
|
||||||
#helander2222 posts blind ($0.25), lopllopl posts blind ($0.50).
|
#helander2222 posts blind ($0.25), lopllopl posts blind ($0.50).
|
||||||
player_re = "(?P<PNAME>" + "|".join(map(re.escape, players)) + ")"
|
player_re = "(?P<PNAME>" + "|".join(map(re.escape, players)) + ")"
|
||||||
subst = {'PLYR': player_re, 'CUR': self.sym[hand.gametype['currency']]}
|
subst = {'PLYR': player_re, 'CUR': self.sym[hand.gametype['currency']]}
|
||||||
re_PostSB = re.compile('(?P<PNAME>.*) posts blind \(\$?(?P<SB>[.0-9]+)\), ')
|
self.re_PostSB = re.compile('(?P<PNAME>.*) posts small blind \(\$?(?P<SB>[.0-9]+)\)')
|
||||||
re_PostBB = re.compile('\), (?P<PNAME>.*) posts blind \(\$?(?P<BB>[.0-9]+)\).')
|
self.re_PostBB = re.compile('\), (?P<PNAME>.*) posts big blind \(\$?(?P<BB>[.0-9]+)\)')
|
||||||
re_Antes = re.compile(r"^%(PLYR)s: posts the ante %(CUR)s(?P<ANTE>[.0-9]+)" % subst, re.MULTILINE)
|
self.re_Antes = re.compile(r"^%(PLYR)s: posts the ante %(CUR)s(?P<ANTE>[.0-9]+)" % subst, re.MULTILINE)
|
||||||
re_BringIn = re.compile(r"^%(PLYR)s: brings[- ]in( low|) for %(CUR)s(?P<BRINGIN>[.0-9]+)" % subst, re.MULTILINE)
|
self.re_BringIn = re.compile(r"^%(PLYR)s: brings[- ]in( low|) for %(CUR)s(?P<BRINGIN>[.0-9]+)" % subst, re.MULTILINE)
|
||||||
re_PostBoth = re.compile('.*\n(?P<PNAME>.*): posts small \& big blinds \[\$? (?P<SBBB>[.0-9]+)')
|
self.re_PostBoth = re.compile('.*\n(?P<PNAME>.*): posts small \& big blinds \(\$? (?P<SBBB>[.0-9]+)\)')
|
||||||
re_HeroCards = re.compile('.*\nDealt\sto\s(?P<PNAME>.*)\s\[ (?P<CARDS>.*) \]')
|
self.re_HeroCards = re.compile('.*\nDealt\sto\s(?P<PNAME>.*)\s\[ (?P<CARDS>.*) \]')
|
||||||
|
|
||||||
#lopllopl checks, Eurolll checks, .Lucchess checks.
|
#lopllopl checks, Eurolll checks, .Lucchess checks.
|
||||||
re_Action = re.compile('(, )?(?P<PNAME>.*?)(?P<ATYPE> bets| checks| raises| calls| folds)( \$(?P<BET>\d*\.?\d*))?( and is all-in)?')
|
self.re_Action = re.compile('(, )?(?P<PNAME>.*?)(?P<ATYPE> bets| checks| raises| calls| folds)( (?P<BET>\d*\.?\d*))?( and is all-in)?')
|
||||||
re_Board = re.compile(r"\[board cards (?P<CARDS>.+) \]")
|
#self.re_Board = re.compile(r"\[board cards (?P<CARDS>.+) \]")
|
||||||
|
|
||||||
#Uchilka shows [ KC,JD ]
|
#Uchilka shows [ KC,JD ]
|
||||||
re_ShowdownAction = re.compile('(?P<PNAME>.*) shows \[ (?P<CARDS>.+) \]')
|
self.re_ShowdownAction = re.compile('(?P<PNAME>.*) shows \[ (?P<CARDS>.+) \]')
|
||||||
|
|
||||||
# TODO: read SUMMARY correctly for collected pot stuff.
|
# TODO: read SUMMARY correctly for collected pot stuff.
|
||||||
#Uchilka, bets $11.75, collects $23.04, net $11.29
|
#Uchilka, bets $11.75, collects $23.04, net $11.29
|
||||||
re_CollectPot = re.compile('(?P<PNAME>.*), bets.+, collects \$(?P<POT>\d*\.?\d*), net.* ')
|
self.re_CollectPot = re.compile('(?P<PNAME>.*), bets.+, collects \$(?P<POT>\d*\.?\d*), net.* ')
|
||||||
re_sitsOut = re.compile('(?P<PNAME>.*) sits out')
|
self.re_sitsOut = re.compile('(?P<PNAME>.*) sits out')
|
||||||
|
|
||||||
def readSupportedGames(self):
|
def readSupportedGames(self):
|
||||||
return [
|
return [
|
||||||
|
@ -179,9 +187,11 @@ class OnGame(HandHistoryConverter):
|
||||||
# So we need to re-interpret te string to be useful
|
# So we need to re-interpret te string to be useful
|
||||||
m1 = self.re_DateTime.finditer(info[key])
|
m1 = self.re_DateTime.finditer(info[key])
|
||||||
for a in m1:
|
for a in m1:
|
||||||
datetimestr = "%s %s %s %s:%s:%s" % (a.group('M'),a.group('D'), a.group('Y'), a.group('H'),a.group('MIN'),a.group('S'))
|
datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'),a.group('M'), a.group('D'), a.group('H'),a.group('MIN'),a.group('S'))
|
||||||
hand.startTime = time.strptime(datetimestr, "%b %d %Y %H:%M:%S")
|
tzoffset = a.group('OFFSET')
|
||||||
# TODO: Manually adjust time against OFFSET
|
# TODO: Manually adjust time against OFFSET
|
||||||
|
hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%b/%d %H:%M:%S") # also timezone at end, e.g. " ET"
|
||||||
|
hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, tzoffset, "UTC")
|
||||||
if key == 'HID':
|
if key == 'HID':
|
||||||
hand.handid = info[key]
|
hand.handid = info[key]
|
||||||
if key == 'TABLE':
|
if key == 'TABLE':
|
||||||
|
@ -206,10 +216,10 @@ class OnGame(HandHistoryConverter):
|
||||||
#elif hand.gametype['base'] in ("stud"):
|
#elif hand.gametype['base'] in ("stud"):
|
||||||
#elif hand.gametype['base'] in ("draw"):
|
#elif hand.gametype['base'] in ("draw"):
|
||||||
# only holdem so far:
|
# only holdem so far:
|
||||||
m = re.search(r"pocket cards(?P<PREFLOP>.+(?=flop)|.+(?=Summary))"
|
m = re.search(r"pocket cards(?P<PREFLOP>.+(?= Dealing flop )|.+(?=Summary))"
|
||||||
r"(flop (?P<FLOP>\[\S\S, \S\S, \S\S\].+(?=turn)|.+(?=Summary)))?"
|
r"( Dealing flop (?P<FLOP>\[\S\S, \S\S, \S\S\].+(?= Dealing turn)|.+(?=Summary)))?"
|
||||||
r"(turn (?P<TURN>\[\S\S, \S\S, \S\S\, \S\S\].+(?=river)|.+(?=Summary)))?"
|
r"( Dealing turn (?P<TURN>\[\S\S\].+(?= Dealing river)|.+(?=Summary)))?"
|
||||||
r"(river (?P<RIVER>\[\S\S, \S\S, \S\S\, \S\S, \S\S\].+(?=Summary)))?", hand.handText, re.DOTALL)
|
r"( Dealing river (?P<RIVER>\[\S\S\].+(?=Summary)))?", hand.handText, re.DOTALL)
|
||||||
|
|
||||||
hand.addStreets(m)
|
hand.addStreets(m)
|
||||||
|
|
||||||
|
@ -224,17 +234,27 @@ class OnGame(HandHistoryConverter):
|
||||||
else:
|
else:
|
||||||
log.info(_('readButton: not found'))
|
log.info(_('readButton: not found'))
|
||||||
|
|
||||||
def readCommunityCards(self, hand, street):
|
# def readCommunityCards(self, hand, street):
|
||||||
print hand.streets.group(street)
|
# #print hand.streets.group(street)
|
||||||
|
# if street in ('FLOP','TURN','RIVER'): # a list of streets which get dealt community cards (i.e. all but PREFLOP)
|
||||||
|
# m = self.re_Board.search(hand.streets.group(street))
|
||||||
|
# hand.setCommunityCards(street, m.group('CARDS').split(','))
|
||||||
|
|
||||||
|
def readCommunityCards(self, hand, street): # street has been matched by markStreets, so exists in this hand
|
||||||
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)
|
||||||
m = self.re_Board.search(hand.streets.group(street))
|
#print "DEBUG readCommunityCards:", street, hand.streets.group(street)
|
||||||
hand.setCommunityCards(street, m.group('CARDS').split(','))
|
m = self.re_Board.search(hand.streets[street])
|
||||||
|
hand.setCommunityCards(street, m.group('CARDS').split(', '))
|
||||||
|
|
||||||
def readBlinds(self, hand):
|
def readBlinds(self, hand):
|
||||||
|
log.debug( _("readBlinds starting") )
|
||||||
try:
|
try:
|
||||||
m = self.re_PostSB.search(hand.handText)
|
m = self.re_PostSB.search(hand.handText)
|
||||||
|
if m is None:
|
||||||
|
log.debug( _("re_postSB failed, hand=") + hand.handText )
|
||||||
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB'))
|
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB'))
|
||||||
except: # no small blind
|
except: # no small blind
|
||||||
|
log.debug( _("readBlinds in noSB exception")+str(sys.exc_info()) )
|
||||||
hand.addBlind(None, None, None)
|
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(a.group('PNAME'), 'big blind', a.group('BB'))
|
hand.addBlind(a.group('PNAME'), 'big blind', a.group('BB'))
|
||||||
|
@ -267,7 +287,7 @@ class OnGame(HandHistoryConverter):
|
||||||
cards = set(cards.split(','))
|
cards = set(cards.split(','))
|
||||||
hand.addHoleCards(cards, m.group('PNAME'))
|
hand.addHoleCards(cards, m.group('PNAME'))
|
||||||
|
|
||||||
def readAction(self, hand, street):
|
def readAction_old(self, hand, street):
|
||||||
m = self.re_Action.finditer(hand.streets.group(street))
|
m = self.re_Action.finditer(hand.streets.group(street))
|
||||||
for action in m:
|
for action in m:
|
||||||
if action.group('ATYPE') == ' raises':
|
if action.group('ATYPE') == ' raises':
|
||||||
|
@ -285,6 +305,28 @@ class OnGame(HandHistoryConverter):
|
||||||
#hand.actions[street] += [[action.group('PNAME'), action.group('ATYPE')]]
|
#hand.actions[street] += [[action.group('PNAME'), action.group('ATYPE')]]
|
||||||
# TODO: Everleaf does not record uncalled bets.
|
# TODO: Everleaf does not record uncalled bets.
|
||||||
|
|
||||||
|
def readAction(self, hand, street):
|
||||||
|
m = self.re_Action.finditer(hand.streets[street])
|
||||||
|
for action in m:
|
||||||
|
acts = action.groupdict()
|
||||||
|
#print "DEBUG: acts: %s" %acts
|
||||||
|
if action.group('ATYPE') == ' raises':
|
||||||
|
hand.addRaiseBy( street, action.group('PNAME'), action.group('BET') )
|
||||||
|
elif action.group('ATYPE') == ' calls':
|
||||||
|
hand.addCall( street, action.group('PNAME'), action.group('BET') )
|
||||||
|
elif action.group('ATYPE') == ' bets':
|
||||||
|
hand.addBet( street, action.group('PNAME'), action.group('BET') )
|
||||||
|
elif action.group('ATYPE') == ' folds':
|
||||||
|
hand.addFold( street, action.group('PNAME'))
|
||||||
|
elif action.group('ATYPE') == ' checks':
|
||||||
|
hand.addCheck( street, action.group('PNAME'))
|
||||||
|
elif action.group('ATYPE') == ' discards':
|
||||||
|
hand.addDiscard(street, action.group('PNAME'), action.group('BET'), action.group('DISCARDED'))
|
||||||
|
elif action.group('ATYPE') == ' stands pat':
|
||||||
|
hand.addStandsPat( street, action.group('PNAME'))
|
||||||
|
else:
|
||||||
|
print _("DEBUG: unimplemented readAction: '%s' '%s'") %(action.group('PNAME'),action.group('ATYPE'),)
|
||||||
|
|
||||||
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):
|
||||||
cards = shows.group('CARDS')
|
cards = shows.group('CARDS')
|
||||||
|
|
|
@ -40,6 +40,18 @@ import win32api
|
||||||
import win32con
|
import win32con
|
||||||
import win32security
|
import win32security
|
||||||
|
|
||||||
|
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
|
||||||
from TableWindow import Table_Window
|
from TableWindow import Table_Window
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user