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

This commit is contained in:
Eric Blade 2010-09-20 05:23:18 -04:00
commit e579d047d6
2 changed files with 31 additions and 16 deletions

View File

@ -56,7 +56,7 @@ class Hand(object):
# Class Variables
UPS = {'a':'A', 't':'T', 'j':'J', 'q':'Q', 'k':'K', 'S':'s', 'C':'c', 'H':'h', 'D':'d'}
LCS = {'H':'h', 'D':'d', 'C':'c', 'S':'s'}
SYMBOL = {'USD': '$', 'EUR': u'$', 'T$': '', 'play': ''}
SYMBOL = {'USD': '$', 'EUR': u'$', 'GBP': '$', 'T$': '', 'play': ''}
MS = {'horse' : 'HORSE', '8game' : '8-Game', 'hose' : 'HOSE', 'ha': 'HA'}

View File

@ -22,6 +22,18 @@ import sys
import datetime
from HandHistoryConverter import *
import locale
lang=locale.getdefaultlocale()[0][0:2]
if lang=="en":
def _(string): return string
else:
import gettext
try:
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
trans.install()
except IOError:
def _(string): return string
# Win2day HH Format
class Win2day(HandHistoryConverter):
@ -88,8 +100,10 @@ class Win2day(HandHistoryConverter):
m = self.re_GameInfo.search(handText)
if not m:
print "determineGameType:", handText
return None
tmp = handText[0:100]
log.error(_("determineGameType: Unable to recognise gametype from: '%s'") % tmp)
log.error(_("determineGameType: Raising FpdbParseError"))
raise FpdbParseError(_("Unable to recognise gametype from: '%s'") % tmp)
mg = m.groupdict()
@ -98,7 +112,8 @@ class Win2day(HandHistoryConverter):
limits = { 'NL':'nl', 'PL':'pl'}
games = { # base, category
"GAME_THM" : ('hold','holdem'),
# 'Omaha' : ('hold','omahahi'),
"GAME_OMA" : ('hold','omahahi'),
#'Omaha Hi/Lo' : ('hold','omahahilo'),
# 'Razz' : ('stud','razz'),
#'7 Card Stud' : ('stud','studhi'),
@ -182,14 +197,14 @@ class Win2day(HandHistoryConverter):
if street in ('FLOP','TURN','RIVER'): # a list of streets which get dealt community cards (i.e. all but PREFLOP)
#print "DEBUG readCommunityCards:", street, hand.streets.group(street)
boardCards = set([])
boardCards = []
if street == 'FLOP':
m = self.re_Card.findall(hand.streets[street])
for card in m:
boardCards.add(self.convertWin2dayCards(card))
boardCards.append(self.convertWin2dayCards(card))
else:
m = self.re_BoardLast.search(hand.streets[street])
boardCards.add(self.convertWin2dayCards(m.group('CARD')))
boardCards.append(self.convertWin2dayCards(m.group('CARD')))
hand.setCommunityCards(street, boardCards)
@ -225,7 +240,7 @@ class Win2day(HandHistoryConverter):
for found in m:
hand.hero = found.group('PNAME')
for card in self.re_Card.finditer(found.group('CARDS')):
print self.convertWin2dayCards(card.group('CARD'))
#print self.convertWin2dayCards(card.group('CARD'))
newcards.append(self.convertWin2dayCards(card.group('CARD')))
#hand.addHoleCards(holeCards, m.group('PNAME'))
@ -267,13 +282,13 @@ class Win2day(HandHistoryConverter):
newcards = player.group('NEWCARDS')
oldcards = player.group('OLDCARDS')
if newcards == None:
newcards = set()
newcards = []
else:
newcards = set(newcards.split(' '))
newcards = newcards.split(' ')
if oldcards == None:
oldcards = set()
oldcards = []
else:
oldcards = set(oldcards.split(' '))
oldcards = oldcards.split(' ')
hand.addDrawHoleCards(newcards, oldcards, player.group('PNAME'), street)
@ -337,10 +352,10 @@ class Win2day(HandHistoryConverter):
def readShowdownActions(self, hand):
for shows in self.re_ShowdownAction.finditer(hand.handText):
showdownCards = set([])
showdownCards = []
for card in self.re_Card.finditer(shows.group('CARDS')):
#print "DEBUG:", card, card.group('CARD'), self.convertWin2dayCards(card.group('CARD'))
showdownCards.add(self.convertWin2dayCards(card.group('CARD')))
showdownCards.append(self.convertWin2dayCards(card.group('CARD')))
hand.addShownCards(showdownCards, shows.group('PNAME'))
@ -354,7 +369,7 @@ class Win2day(HandHistoryConverter):
for m in self.re_ShownCards.finditer(hand.handText):
if m.group('CARDS') is not None:
cards = m.group('CARDS')
cards = set(cards.split(' '))
cards = cards.split(' ')
hand.addShownCards(cards=cards, player=m.group('PNAME'))
if __name__ == "__main__":