Merge branch 'master' into next
trivial string conflict
This commit is contained in:
commit
0a512dada5
49
pyfpdb/EverleafToFpdb.py
Executable file → Normal file
49
pyfpdb/EverleafToFpdb.py
Executable file → Normal file
|
@ -34,19 +34,33 @@ class Everleaf(HandHistoryConverter):
|
||||||
codepage = "cp1252"
|
codepage = "cp1252"
|
||||||
siteId = 3 # Needs to match id entry in Sites database
|
siteId = 3 # Needs to match id entry in Sites database
|
||||||
|
|
||||||
|
substitutions = {
|
||||||
|
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
|
||||||
|
'LS' : u"\$|\u20AC|\xe2\x82\xac|\x80|", # legal currency symbols - Euro(cp1252, utf-8) #TODO change \x80 to \x20\x80, update all regexes accordingly
|
||||||
|
'TAB' : u"-\u2013'\s\da-zA-Z#_", # legal characters for tablename
|
||||||
|
'NUM' : u".,\d", # legal characters in number format
|
||||||
|
}
|
||||||
|
|
||||||
# Static regexes
|
# Static regexes
|
||||||
re_SplitHands = re.compile(r"\n\n\n+")
|
re_SplitHands = re.compile(r"\n\n\n+")
|
||||||
re_TailSplitHands = re.compile(r"(\n\n\n+)")
|
re_TailSplitHands = re.compile(r"(\n\n\n+)")
|
||||||
re_GameInfo = re.compile(ur"^(Blinds )?(?P<CURRENCY>[$€]?)(?P<SB>[.0-9]+)/[$€]?(?P<BB>[.0-9]+) (?P<LIMIT>NL|PL|) ?(?P<GAME>(Hold\'em|Omaha|7 Card Stud))", re.MULTILINE)
|
re_GameInfo = re.compile(ur"^(Blinds )? ?(?P<CURRENCY>[%(LS)s]?)(?P<SB>[.0-9]+) ?/ ? ?[%(LS)s]?(?P<BB>[.0-9]+) (?P<LIMIT>NL|PL|) ?(?P<GAME>(Hold\'em|Omaha|7 Card Stud))" % substitutions, re.MULTILINE)
|
||||||
#re.compile(ur"^(Blinds )?(?P<CURRENCY>\$| €|)(?P<SB>[.0-9]+)/(?:\$| €)?(?P<BB>[.0-9]+) (?P<LIMIT>NL|PL|) ?(?P<GAME>(Hold\'em|Omaha|7 Card Stud))", re.MULTILINE)
|
|
||||||
re_HandInfo = re.compile(ur".*#(?P<HID>[0-9]+)\n.*\n(Blinds )?(?P<CURRENCY>[$€])?(?P<SB>[.0-9]+)/(?:[$€])?(?P<BB>[.0-9]+) (?P<GAMETYPE>.*) - (?P<DATETIME>\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P<TABLE>.+$)", re.MULTILINE)
|
#re_HandInfo = re.compile(ur".*#(?P<HID>[0-9]+)\n.*\n(Blinds )?(?P<CURRENCY>[$€])?(?P<SB>[.0-9]+)/(?:[$€])?(?P<BB>[.0-9]+) (?P<GAMETYPE>.*) - (?P<DATETIME>\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P<TABLE>.+$)", re.MULTILINE)
|
||||||
|
|
||||||
|
re_HandInfo = re.compile(ur".*\n(.*#|.* partie )(?P<HID>[0-9]+).*(\n|\n\n)(Blinds )? ?(?P<CURRENCY>[%(LS)s])?(?P<SB>[.0-9]+) ?/ ?(?:[%(LS)s])?(?P<BB>[.0-9]+) (?P<GAMETYPE>.*) - (?P<DATETIME>\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P<TABLE>.+$)" % substitutions, re.MULTILINE)
|
||||||
|
#
|
||||||
|
|
||||||
|
#re_HandInfo = re.compile(ur"(.*#|.*\n.* partie )(?P<HID>[0-9]+).*(\n|\n\n)(Blinds )?(?:\$| €|)(?P<SB>[.0-9]+)/(?:\$| €|)(?P<BB>[.0-9]+) (?P<GAMETYPE>.*) - (?P<DATETIME>\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P<TABLE>.+$)", re.MULTILINE)
|
||||||
|
|
||||||
|
|
||||||
re_Button = re.compile(ur"^Seat (?P<BUTTON>\d+) is the button$", re.MULTILINE)
|
re_Button = re.compile(ur"^Seat (?P<BUTTON>\d+) is the button$", re.MULTILINE)
|
||||||
re_PlayerInfo = re.compile(ur"""^Seat\s(?P<SEAT>[0-9]+):\s(?P<PNAME>.*)\s+
|
re_PlayerInfo = re.compile(ur"""^Seat\s(?P<SEAT>[0-9]+):\s(?P<PNAME>.*)\s+
|
||||||
\(
|
\(
|
||||||
\s+[$€]?\s?(?P<CASH>[.0-9]+)
|
\s+[%(LS)s]?\s?(?P<CASH>[.0-9]+)
|
||||||
(\s(USD|EURO|Chips)?(new\splayer|All-in)?)?
|
(\s(USD|EURO|EUR|Chips)?(new\splayer|All-in)?)?
|
||||||
\s?\)$
|
\s?\)$
|
||||||
""", re.MULTILINE|re.VERBOSE)
|
""" % substitutions, re.MULTILINE|re.VERBOSE)
|
||||||
re_Board = re.compile(ur"\[ (?P<CARDS>.+) \]")
|
re_Board = re.compile(ur"\[ (?P<CARDS>.+) \]")
|
||||||
re_TourneyInfoFromFilename = re.compile(ur".*TID_(?P<TOURNO>[0-9]+)-(?P<TABLE>[0-9]+)\.txt")
|
re_TourneyInfoFromFilename = re.compile(ur".*TID_(?P<TOURNO>[0-9]+)-(?P<TABLE>[0-9]+)\.txt")
|
||||||
|
|
||||||
|
@ -58,16 +72,16 @@ class Everleaf(HandHistoryConverter):
|
||||||
self.compiledPlayers = players
|
self.compiledPlayers = players
|
||||||
player_re = "(?P<PNAME>" + "|".join(map(re.escape, players)) + ")"
|
player_re = "(?P<PNAME>" + "|".join(map(re.escape, players)) + ")"
|
||||||
logging.debug("player_re: "+ player_re)
|
logging.debug("player_re: "+ player_re)
|
||||||
self.re_PostSB = re.compile(ur"^%s: posts small blind \[[$€]? (?P<SB>[.0-9]+)\s.*\]$" % player_re, re.MULTILINE)
|
self.re_PostSB = re.compile(ur"^%s: posts small blind \[ ?[%s]? (?P<SB>[.0-9]+)\s.*\]$" % (player_re, self.substitutions["LS"]), re.MULTILINE)
|
||||||
self.re_PostBB = re.compile(ur"^%s: posts big blind \[[$€]? (?P<BB>[.0-9]+)\s.*\]$" % player_re, re.MULTILINE)
|
self.re_PostBB = re.compile(ur"^%s: posts big blind \[ ?[%s]? (?P<BB>[.0-9]+)\s.*\]$" % (player_re, self.substitutions["LS"]), re.MULTILINE)
|
||||||
self.re_PostBoth = re.compile(ur"^%s: posts both blinds \[[$€]? (?P<SBBB>[.0-9]+)\s.*\]$" % player_re, re.MULTILINE)
|
self.re_PostBoth = re.compile(ur"^%s: posts both blinds \[ ?[%s]? (?P<SBBB>[.0-9]+)\s.*\]$" % (player_re, self.substitutions["LS"]), re.MULTILINE)
|
||||||
self.re_Antes = re.compile(ur"^%s: posts ante \[[$€]? (?P<ANTE>[.0-9]+)\s.*\]$" % player_re, re.MULTILINE)
|
self.re_Antes = re.compile(ur"^%s: posts ante \[ ?[%s]? (?P<ANTE>[.0-9]+)\s.*\]$" % (player_re, self.substitutions["LS"]), re.MULTILINE)
|
||||||
self.re_BringIn = re.compile(ur"^%s posts bring-in [$€]? (?P<BRINGIN>[.0-9]+)\." % player_re, re.MULTILINE)
|
self.re_BringIn = re.compile(ur"^%s posts bring-in ?[%s]? (?P<BRINGIN>[.0-9]+)\." % (player_re, self.substitutions["LS"]), re.MULTILINE)
|
||||||
self.re_HeroCards = re.compile(ur"^Dealt to %s \[ (?P<CARDS>.*) \]$" % player_re, re.MULTILINE)
|
self.re_HeroCards = re.compile(ur"^Dealt to %s \[ (?P<CARDS>.*) \]$" % player_re, re.MULTILINE)
|
||||||
# ^%s(?P<ATYPE>: bets| checks| raises| calls| folds)(\s\[(?:\$| €|) (?P<BET>[.,\d]+) (USD|EURO|Chips)\])?
|
# ^%s(?P<ATYPE>: bets| checks| raises| calls| folds)(\s\[(?:\$| €|) (?P<BET>[.,\d]+) (USD|EURO|EUR|Chips)\])?
|
||||||
self.re_Action = re.compile(ur"^%s(?P<ATYPE>: bets| checks| raises| calls| folds)(\s\[(?:[$€]?) (?P<BET>[.,\d]+)\s?(USD|EURO|Chips|)\])?" % player_re, re.MULTILINE)
|
self.re_Action = re.compile(ur"^%s(?P<ATYPE>: bets| checks| raises| calls| folds)(\s\[(?: ?[%s]?) (?P<BET>[.,\d]+)\s?(USD|EURO|EUR|Chips|)\])?" % (player_re, self.substitutions["LS"]), re.MULTILINE)
|
||||||
self.re_ShowdownAction = re.compile(ur"^%s shows \[ (?P<CARDS>.*) \]" % player_re, re.MULTILINE)
|
self.re_ShowdownAction = re.compile(ur"^%s shows \[ (?P<CARDS>.*) \]" % player_re, re.MULTILINE)
|
||||||
self.re_CollectPot = re.compile(ur"^%s wins (?:[$€]?)\s?(?P<POT>[.\d]+) (USD|EURO|chips)(.*?\[ (?P<CARDS>.*?) \])?" % player_re, re.MULTILINE)
|
self.re_CollectPot = re.compile(ur"^%s wins ?(?: ?[%s]?)\s?(?P<POT>[.\d]+) (USD|EURO|EUR|chips)(.*?\[ (?P<CARDS>.*?) \])?" % (player_re, self.substitutions["LS"]), re.MULTILINE)
|
||||||
self.re_SitsOut = re.compile(ur"^%s sits out" % player_re, re.MULTILINE)
|
self.re_SitsOut = re.compile(ur"^%s sits out" % player_re, re.MULTILINE)
|
||||||
|
|
||||||
def readSupportedGames(self):
|
def readSupportedGames(self):
|
||||||
|
@ -107,9 +121,10 @@ or None if we fail to get the info """
|
||||||
# Table 2
|
# Table 2
|
||||||
info = {'type':'ring'}
|
info = {'type':'ring'}
|
||||||
|
|
||||||
|
|
||||||
m = self.re_GameInfo.search(handText)
|
m = self.re_GameInfo.search(handText)
|
||||||
if not m:
|
if not m:
|
||||||
tmp = handText[0:100]
|
tmp = handText[0:150]
|
||||||
log.error(_("Unable to recognise gametype from: '%s'") % tmp)
|
log.error(_("Unable to recognise gametype from: '%s'") % tmp)
|
||||||
log.error("determineGameType: " + _("Raising FpdbParseError"))
|
log.error("determineGameType: " + _("Raising FpdbParseError"))
|
||||||
raise FpdbParseError(_("Unable to recognise gametype from: '%s'") % tmp)
|
raise FpdbParseError(_("Unable to recognise gametype from: '%s'") % tmp)
|
||||||
|
@ -254,8 +269,10 @@ or None if we fail to get the info """
|
||||||
#Not involved in hand
|
#Not involved in hand
|
||||||
hand.involved = False
|
hand.involved = False
|
||||||
|
|
||||||
|
|
||||||
def readStudPlayerCards(self, hand, street):
|
def readStudPlayerCards(self, hand, street):
|
||||||
logging.warning(_("Absolute cannot read all stud/razz hands yet."))
|
logging.warning(_("Everleaf cannot read all stud/razz hands yet."))
|
||||||
|
|
||||||
|
|
||||||
def readAction(self, hand, street):
|
def readAction(self, hand, street):
|
||||||
logging.debug("readAction (%s)" % street)
|
logging.debug("readAction (%s)" % street)
|
||||||
|
|
|
@ -171,6 +171,7 @@ class Fulltilt(HandHistoryConverter):
|
||||||
self.re_PostDead = re.compile(r"^%(PLAYERS)s posts a dead small blind of [%(LS)s]?(?P<SB>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
self.re_PostDead = re.compile(r"^%(PLAYERS)s posts a dead small blind of [%(LS)s]?(?P<SB>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
||||||
self.re_PostBB = re.compile(r"^%(PLAYERS)s posts (the big blind of )?[%(LS)s]?(?P<BB>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
self.re_PostBB = re.compile(r"^%(PLAYERS)s posts (the big blind of )?[%(LS)s]?(?P<BB>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
||||||
self.re_Antes = re.compile(r"^%(PLAYERS)s antes [%(LS)s]?(?P<ANTE>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
self.re_Antes = re.compile(r"^%(PLAYERS)s antes [%(LS)s]?(?P<ANTE>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
||||||
|
self.re_ReturnsAnte = re.compile(r"^Ante of [%(LS)s]?[%(NUM)s]+ returned to %(PLAYERS)s" % self.substitutions, re.MULTILINE)
|
||||||
self.re_BringIn = re.compile(r"^%(PLAYERS)s brings in for [%(LS)s]?(?P<BRINGIN>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
self.re_BringIn = re.compile(r"^%(PLAYERS)s brings in for [%(LS)s]?(?P<BRINGIN>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
||||||
self.re_PostBoth = re.compile(r"^%(PLAYERS)s posts small \& big blinds \[[%(LS)s]? (?P<SBBB>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
self.re_PostBoth = re.compile(r"^%(PLAYERS)s posts small \& big blinds \[[%(LS)s]? (?P<SBBB>[%(NUM)s]+)" % self.substitutions, re.MULTILINE)
|
||||||
self.re_HeroCards = re.compile(r"^Dealt to %s(?: \[(?P<OLDCARDS>.+?)\])?( \[(?P<NEWCARDS>.+?)\])" % player_re, re.MULTILINE)
|
self.re_HeroCards = re.compile(r"^Dealt to %s(?: \[(?P<OLDCARDS>.+?)\])?( \[(?P<NEWCARDS>.+?)\])" % player_re, re.MULTILINE)
|
||||||
|
@ -356,8 +357,9 @@ class Fulltilt(HandHistoryConverter):
|
||||||
# Remove any listed as sitting out in the summary as start of hand info unreliable
|
# Remove any listed as sitting out in the summary as start of hand info unreliable
|
||||||
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')]
|
if b.group('PNAME') in plist:
|
||||||
#print "DEBUG: Deleting '%s' from player dict" %(b.group('PNAME'))
|
#print "DEBUG: Deleting '%s' from player dict" %(b.group('PNAME'))
|
||||||
|
del plist[b.group('PNAME')]
|
||||||
|
|
||||||
# Add remaining players
|
# Add remaining players
|
||||||
for a in plist:
|
for a in plist:
|
||||||
|
@ -414,11 +416,16 @@ class Fulltilt(HandHistoryConverter):
|
||||||
|
|
||||||
def readAntes(self, hand):
|
def readAntes(self, hand):
|
||||||
logging.debug(_("reading antes"))
|
logging.debug(_("reading antes"))
|
||||||
|
slist = []
|
||||||
|
n = self.re_ReturnsAnte.finditer(hand.handText)
|
||||||
|
for player in n:
|
||||||
|
#If a player has their ante returned, then they timed out and are actually sitting out
|
||||||
|
slist.append(player.group('PNAME'))
|
||||||
m = self.re_Antes.finditer(hand.handText)
|
m = self.re_Antes.finditer(hand.handText)
|
||||||
for player in m:
|
for player in m:
|
||||||
logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE')))
|
logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE')))
|
||||||
# if player.group() !=
|
if player.group('PNAME') not in slist:
|
||||||
hand.addAnte(player.group('PNAME'), player.group('ANTE'))
|
hand.addAnte(player.group('PNAME'), player.group('ANTE'))
|
||||||
|
|
||||||
def readBringIn(self, hand):
|
def readBringIn(self, hand):
|
||||||
m = self.re_BringIn.search(hand.handText,re.DOTALL)
|
m = self.re_BringIn.search(hand.handText,re.DOTALL)
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
Partouche Poker Gibraltar
|
||||||
|
*** Historique des Mains pour la partie 25324991 ***
|
||||||
|
Blinds €0.01/ €0.02 NL Hold'em - 2009/10/27 - 19:04:57
|
||||||
|
Table Andernos 2
|
||||||
|
Seat 1 is the button
|
||||||
|
Total number of players: 6
|
||||||
|
Seat 1: player1 ( € 0.76 EUR )
|
||||||
|
Seat 2: player2 ( € 1.83 EUR )
|
||||||
|
Seat 3: player3 ( € 0.81 EUR )
|
||||||
|
Seat 4: player4 ( € 2 EUR )
|
||||||
|
Seat 5: player5 ( € 1.39 EUR )
|
||||||
|
Seat 6: player6 ( new player )
|
||||||
|
player2: posts small blind [ € 0.01 EUR]
|
||||||
|
player3: posts big blind [ € 0.02 EUR]
|
||||||
|
player4: posts big blind [ € 0.02 EUR]
|
||||||
|
** Dealing down cards **
|
||||||
|
Dealt to player4 [ 5s, 4s ]
|
||||||
|
player4 checks
|
||||||
|
player5 raises [ € 0.04 EUR]
|
||||||
|
player1 folds
|
||||||
|
player2 calls [ € 0.03 EUR]
|
||||||
|
player3 est déconnecté et dispose de 20 secondes supplémentaires pour agir
|
||||||
|
player3 calls [ € 0.02 EUR]
|
||||||
|
player4 calls [ € 0.02 EUR]
|
||||||
|
** Dealing Flop ** [ Qs, 8s, 7c ]
|
||||||
|
player3 est déconnecté et dispose de 20 secondes supplémentaires pour agir
|
||||||
|
player2 checks
|
||||||
|
player3 est déconnecté et dispose de 20 secondes supplémentaires pour agir
|
||||||
|
player3 checks
|
||||||
|
player4: bets [ € 0.08 EUR]
|
||||||
|
player5 raises [ € 0.16 EUR]
|
||||||
|
player2 folds
|
||||||
|
player3 calls [ € 0.16 EUR]
|
||||||
|
player4 calls [ € 0.08 EUR]
|
||||||
|
** Dealing Turn ** [ Th ]
|
||||||
|
player3 checks
|
||||||
|
player4 checks
|
||||||
|
player5: bets [ € 0.64 EUR]
|
||||||
|
player3 folds
|
||||||
|
player4 calls [ € 0.64 EUR]
|
||||||
|
** Dealing River ** [ Tc ]
|
||||||
|
player4: bets [ € 1.16 EUR]
|
||||||
|
player5 calls [ € 0.55 EUR]
|
||||||
|
player4 shows [ 5s, 4s ]a pair of tens
|
||||||
|
player5 shows [ Qh, Ad ]two pairs, queens and tens
|
||||||
|
player5 wins € 2.72 EUR from main pot with two pairs, queens and tens [ Ad, Qh, Qs, Th, Tc ]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user