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)
|
logging.debug("readCommunityCards (%s)" % street)
|
||||||
m = self.re_Board.search(hand.streets[street])
|
m = self.re_Board.search(hand.streets[street])
|
||||||
cards = m.group('CARDS')
|
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)
|
hand.setCommunityCards(street=street, cards=cards)
|
||||||
|
|
||||||
def readAntes(self, hand):
|
def readAntes(self, hand):
|
||||||
|
@ -241,7 +241,7 @@ or None if we fail to get the info """
|
||||||
# "2c, qh" -> ["2c","qc"]
|
# "2c, qh" -> ["2c","qc"]
|
||||||
# Also works with Omaha hands.
|
# Also works with Omaha hands.
|
||||||
cards = m.group('CARDS')
|
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(cards, m.group('PNAME'))
|
||||||
hand.addHoleCards('PREFLOP', hand.hero, closed=cards, shown=False, mucked=False, dealt=True)
|
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
|
#Not involved in hand
|
||||||
hand.involved = False
|
hand.involved = False
|
||||||
|
|
||||||
|
|
||||||
def readStudPlayerCards(self, hand, street):
|
def readStudPlayerCards(self, hand, street):
|
||||||
# lol. see Plymouth.txt
|
# lol. see Plymouth.txt
|
||||||
logging.warning("Absolute readStudPlayerCards is only a stub.")
|
logging.warning("Absolute readStudPlayerCards is only a stub.")
|
||||||
|
@ -283,7 +282,7 @@ or None if we fail to get the info """
|
||||||
logging.debug("readShowdownActions")
|
logging.debug("readShowdownActions")
|
||||||
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')
|
||||||
cards = cards.split(', ')
|
cards = [validCard(card) for card in cards.split(' ')]
|
||||||
logging.debug("readShowdownActions %s %s" %(cards, shows.group('PNAME')))
|
logging.debug("readShowdownActions %s %s" %(cards, shows.group('PNAME')))
|
||||||
hand.addShownCards(cards, shows.group('PNAME'))
|
hand.addShownCards(cards, shows.group('PNAME'))
|
||||||
|
|
||||||
|
@ -298,7 +297,7 @@ or None if we fail to get the info """
|
||||||
try:
|
try:
|
||||||
if m.group('CARDS') is not None:
|
if m.group('CARDS') is not None:
|
||||||
cards = m.group('CARDS')
|
cards = m.group('CARDS')
|
||||||
cards = cards.split(', ')
|
cards = [validCard(card) for card in cards.split(' ')]
|
||||||
player = m.group('PNAME')
|
player = m.group('PNAME')
|
||||||
logging.debug("readShownCards %s cards=%s" % (player, cards))
|
logging.debug("readShownCards %s cards=%s" % (player, cards))
|
||||||
# hand.addShownCards(cards=None, player=m.group('PNAME'), holeandboard=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:
|
except IndexError:
|
||||||
pass # there's no "PLAYER - Mucks" at AP that I can see
|
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__":
|
if __name__ == "__main__":
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
|
|
|
@ -130,6 +130,9 @@ class Importer:
|
||||||
# self.updated = time()
|
# self.updated = time()
|
||||||
|
|
||||||
def clearFileList(self):
|
def clearFileList(self):
|
||||||
|
self.updatedsize = {}
|
||||||
|
self.updatetime = {}
|
||||||
|
self.pos_in_file = {}
|
||||||
self.filelist = {}
|
self.filelist = {}
|
||||||
|
|
||||||
def closeDBs(self):
|
def closeDBs(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user