diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index edb61f3d..40b0ab05 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -133,7 +133,7 @@ or None if we fail to get the info """ if not self.debugging and info['base']=='stud': logging.warning("Not processing Everleaf Stud hand") - return None + #return None return info diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 7ed679a4..9afdc2c9 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -202,17 +202,24 @@ Tail the in_path file and yield handTexts separated by re_SplitHands""" def processHand(self, handText): gametype = self.determineGameType(handText) 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 gametype['base'] == 'hold': - logging.debug("hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handtext)") - hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handText) - elif gametype['base'] == 'stud': - hand = Hand.StudHand(self, self.sitename, gametype, handText) - elif gametype['base'] == 'draw': - hand = Hand.DrawHand(self, self.sitename, gametype, handText) + if l in self.readSupportedGames(): + hand = None + if gametype['base'] == 'hold': + logging.debug("hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handtext)") + hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handText) + elif gametype['base'] == 'stud': + hand = Hand.StudHand(self, self.sitename, gametype, handText) + elif gametype['base'] == 'draw': + hand = Hand.DrawHand(self, self.sitename, gametype, handText) + else: + logging.info("Unsupported game type: %s" % gametype) if hand: 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? # 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 # This function should return a list of lists looking like: # return [["ring", "hold", "nl"], ["tour", "hold", "nl"]] diff --git a/pyfpdb/test_fpdb_simple.py b/pyfpdb/test_fpdb_simple.py index bde20b45..e8b51ec2 100755 --- a/pyfpdb/test_fpdb_simple.py +++ b/pyfpdb/test_fpdb_simple.py @@ -3,16 +3,16 @@ import fpdb_simple import datetime import py -def checkDateParse(header, result): - assert fpdb_simple.parseHandStartTime(header) == result +def checkDateParse(header, site, result): + assert fpdb_simple.parseHandStartTime(header, site) == result def testPokerStarsHHDate(): 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)), - ("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)), - ("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)) ) @@ -36,5 +36,5 @@ def testPokerStarsHHDate(): # 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") - for (header, result) in tuples: - yield checkDateParse header, result + for (header, site, result) in tuples: + yield checkDateParse, header, site, result