AbsoluteToFpdb: convert cards 10s to Ts, etc
fpdb_import: clear updatedsize, updatedtime, pos_in_file lists, so we can attempt multiple imports on same file, rather than just getting error when trying.
This commit is contained in:
parent
34c469ab3a
commit
f85e7cb230
|
@ -201,7 +201,7 @@ or None if we fail to get the info """
|
|||
logging.debug("readCommunityCards (%s)" % street)
|
||||
m = self.re_Board.search(hand.streets[street])
|
||||
cards = m.group('CARDS')
|
||||
cards = [card.strip() for card in cards.split(',')]
|
||||
cards = [validCard(card) for card in cards.split(' ')]
|
||||
hand.setCommunityCards(street=street, cards=cards)
|
||||
|
||||
def readAntes(self, hand):
|
||||
|
@ -241,7 +241,7 @@ or None if we fail to get the info """
|
|||
# "2c, qh" -> ["2c","qc"]
|
||||
# Also works with Omaha hands.
|
||||
cards = m.group('CARDS')
|
||||
cards = [card.strip() for card in cards.split(',')]
|
||||
cards = [validCard(card) for card in cards.split(' ')]
|
||||
# hand.addHoleCards(cards, m.group('PNAME'))
|
||||
hand.addHoleCards('PREFLOP', hand.hero, closed=cards, shown=False, mucked=False, dealt=True)
|
||||
|
||||
|
@ -249,7 +249,6 @@ or None if we fail to get the info """
|
|||
#Not involved in hand
|
||||
hand.involved = False
|
||||
|
||||
|
||||
def readStudPlayerCards(self, hand, street):
|
||||
# lol. see Plymouth.txt
|
||||
logging.warning("Absolute readStudPlayerCards is only a stub.")
|
||||
|
@ -283,7 +282,7 @@ or None if we fail to get the info """
|
|||
logging.debug("readShowdownActions")
|
||||
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
||||
cards = shows.group('CARDS')
|
||||
cards = cards.split(', ')
|
||||
cards = [validCard(card) for card in cards.split(' ')]
|
||||
logging.debug("readShowdownActions %s %s" %(cards, shows.group('PNAME')))
|
||||
hand.addShownCards(cards, shows.group('PNAME'))
|
||||
|
||||
|
@ -298,7 +297,7 @@ or None if we fail to get the info """
|
|||
try:
|
||||
if m.group('CARDS') is not None:
|
||||
cards = m.group('CARDS')
|
||||
cards = cards.split(', ')
|
||||
cards = [validCard(card) for card in cards.split(' ')]
|
||||
player = m.group('PNAME')
|
||||
logging.debug("readShownCards %s cards=%s" % (player, cards))
|
||||
# hand.addShownCards(cards=None, player=m.group('PNAME'), holeandboard=cards)
|
||||
|
@ -306,6 +305,14 @@ or None if we fail to get the info """
|
|||
except IndexError:
|
||||
pass # there's no "PLAYER - Mucks" at AP that I can see
|
||||
|
||||
def validCard(card):
|
||||
card = card.strip()
|
||||
if card == '10s': card = 'Ts'
|
||||
if card == '10h': card = 'Th'
|
||||
if card == '10d': card = 'Td'
|
||||
if card == '10c': card = 'Tc'
|
||||
return card
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
|
|
|
@ -130,6 +130,9 @@ class Importer:
|
|||
# self.updated = time()
|
||||
|
||||
def clearFileList(self):
|
||||
self.updatedsize = {}
|
||||
self.updatetime = {}
|
||||
self.pos_in_file = {}
|
||||
self.filelist = {}
|
||||
|
||||
def closeDBs(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user