Compare determineGameType to readSupportedGames
Allows us to parse the header (and test it) and still skip the file. May produce empty files in autoimport...
This commit is contained in:
parent
bb2104e5f8
commit
2bb4593672
|
@ -133,7 +133,7 @@ or None if we fail to get the info """
|
||||||
|
|
||||||
if not self.debugging and info['base']=='stud':
|
if not self.debugging and info['base']=='stud':
|
||||||
logging.warning("Not processing Everleaf Stud hand")
|
logging.warning("Not processing Everleaf Stud hand")
|
||||||
return None
|
#return None
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
|
@ -202,9 +202,14 @@ Tail the in_path file and yield handTexts separated by re_SplitHands"""
|
||||||
def processHand(self, handText):
|
def processHand(self, handText):
|
||||||
gametype = self.determineGameType(handText)
|
gametype = self.determineGameType(handText)
|
||||||
logging.debug("gametype %s" % gametype)
|
logging.debug("gametype %s" % gametype)
|
||||||
if gametype is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
|
# See if gametype is supported.
|
||||||
|
type = gametype['type']
|
||||||
|
base = gametype['base']
|
||||||
|
limit = gametype['limitType']
|
||||||
|
l = [type] + [base] + [limit]
|
||||||
|
hand = None
|
||||||
|
if l in self.readSupportedGames():
|
||||||
hand = None
|
hand = None
|
||||||
if gametype['base'] == 'hold':
|
if gametype['base'] == 'hold':
|
||||||
logging.debug("hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handtext)")
|
logging.debug("hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handtext)")
|
||||||
|
@ -213,6 +218,8 @@ Tail the in_path file and yield handTexts separated by re_SplitHands"""
|
||||||
hand = Hand.StudHand(self, self.sitename, gametype, handText)
|
hand = Hand.StudHand(self, self.sitename, gametype, handText)
|
||||||
elif gametype['base'] == 'draw':
|
elif gametype['base'] == 'draw':
|
||||||
hand = Hand.DrawHand(self, self.sitename, gametype, handText)
|
hand = Hand.DrawHand(self, self.sitename, gametype, handText)
|
||||||
|
else:
|
||||||
|
logging.info("Unsupported game type: %s" % gametype)
|
||||||
|
|
||||||
if hand:
|
if hand:
|
||||||
hand.writeHand(self.out_fh)
|
hand.writeHand(self.out_fh)
|
||||||
|
@ -221,6 +228,7 @@ Tail the in_path file and yield handTexts separated by re_SplitHands"""
|
||||||
# TODO: pity we don't know the HID at this stage. Log the entire hand?
|
# TODO: pity we don't know the HID at this stage. Log the entire hand?
|
||||||
# From the log we can deduce that it is the hand after the one before :)
|
# From the log we can deduce that it is the hand after the one before :)
|
||||||
|
|
||||||
|
|
||||||
# These functions are parse actions that may be overridden by the inheriting class
|
# These functions are parse actions that may be overridden by the inheriting class
|
||||||
# This function should return a list of lists looking like:
|
# This function should return a list of lists looking like:
|
||||||
# return [["ring", "hold", "nl"], ["tour", "hold", "nl"]]
|
# return [["ring", "hold", "nl"], ["tour", "hold", "nl"]]
|
||||||
|
|
|
@ -3,16 +3,16 @@ import fpdb_simple
|
||||||
import datetime
|
import datetime
|
||||||
import py
|
import py
|
||||||
|
|
||||||
def checkDateParse(header, result):
|
def checkDateParse(header, site, result):
|
||||||
assert fpdb_simple.parseHandStartTime(header) == result
|
assert fpdb_simple.parseHandStartTime(header, site) == result
|
||||||
|
|
||||||
def testPokerStarsHHDate():
|
def testPokerStarsHHDate():
|
||||||
tuples = (
|
tuples = (
|
||||||
("PokerStars Game #21969660557: Hold'em No Limit ($0.50/$1.00) - 2008/11/12 10:00:48 CET [2008/11/12 4:00:48 ET]",
|
("PokerStars Game #21969660557: Hold'em No Limit ($0.50/$1.00) - 2008/11/12 10:00:48 CET [2008/11/12 4:00:48 ET]", "ps",
|
||||||
datetime.datetime(2008,9,7,11,23,14)),
|
datetime.datetime(2008,9,7,11,23,14)),
|
||||||
("PokerStars Game #21969660557: Hold'em No Limit ($0.50/$1.00) - 2008/08/17 - 01:14:43 (ET)",
|
("PokerStars Game #21969660557: Hold'em No Limit ($0.50/$1.00) - 2008/08/17 - 01:14:43 (ET)", "ps",
|
||||||
datetime.datetime(2008,11,12,15,00,48)),
|
datetime.datetime(2008,11,12,15,00,48)),
|
||||||
("PokerStars Game #21969660557: Hold'em No Limit ($0.50/$1.00) - 2008/09/07 06:23:14 ET",
|
("PokerStars Game #21969660557: Hold'em No Limit ($0.50/$1.00) - 2008/09/07 06:23:14 ET", "ps",
|
||||||
datetime.datetime(2008,8,17,6,14,43))
|
datetime.datetime(2008,8,17,6,14,43))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -36,5 +36,5 @@ def testPokerStarsHHDate():
|
||||||
# self.failUnless(result == "French", "French (deep) parsed incorrectly. Expected 'French' got: " + str(result))
|
# self.failUnless(result == "French", "French (deep) parsed incorrectly. Expected 'French' got: " + str(result))
|
||||||
# result = ("French (deep) - $0.25/$0.50 - No Limit Hold'em - Logged In As xxxx")
|
# result = ("French (deep) - $0.25/$0.50 - No Limit Hold'em - Logged In As xxxx")
|
||||||
|
|
||||||
for (header, result) in tuples:
|
for (header, site, result) in tuples:
|
||||||
yield checkDateParse header, result
|
yield checkDateParse, header, site, result
|
||||||
|
|
Loading…
Reference in New Issue
Block a user