diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..f3d74a9a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pyc +*~ diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 8c03a249..ad6ffa4b 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -951,7 +951,7 @@ class Database: #end def dropAllIndexes def fillDefaultData(self): - c = self.get_cursor() + c = self.get_cursor() c.execute("INSERT INTO Settings (version) VALUES (118);") c.execute("INSERT INTO Sites (name,currency) VALUES ('Full Tilt Poker', 'USD')") c.execute("INSERT INTO Sites (name,currency) VALUES ('PokerStars', 'USD')") diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 0946e6f9..75aab808 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -453,6 +453,7 @@ Add a raise on [street] by [player] to [amountTo] def addCheck(self, street, player): #print "DEBUG: %s %s checked" % (street, player) + logging.debug("%s %s checks" % (street, player)) self.checkPlayerExists(player) self.actions[street].append((player, 'checks')) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index bb30e705..fb7311ab 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- #Copyright 2008 Carl Gherardi #This program is free software: you can redistribute it and/or modify @@ -95,9 +96,14 @@ Otherwise, finish at eof. else: handsList = self.allHandsAsList() logging.info("Parsing %d hands" % len(handsList)) + nBadHangs = 0 for handText in handsList: - self.processedHands.append(self.processHand(handText)) - numHands= len(handsList) + try: + self.processedHands.append(self.processHand(handText)) + except Exception, e: # TODO: it's better to replace it with s-t like HhcEception + nBadHangs += 1 + logging.error("Caught exception while parsing hand: %s" % str(e)) + numHands = len(handsList) - nBadHangs endtime = time.time() print "read %d hands in %.3f seconds" % (numHands, endtime - starttime) if self.out_fh != sys.stdout: diff --git a/pyfpdb/PartyPokerToFpdb.py b/pyfpdb/PartyPokerToFpdb.py index c0161bf0..af1081df 100644 --- a/pyfpdb/PartyPokerToFpdb.py +++ b/pyfpdb/PartyPokerToFpdb.py @@ -70,25 +70,6 @@ class PartyPoker(HandHistoryConverter): (?P.+) """, re.VERBOSE) re_Hid = re.compile("^Game \#(?P\d+) starts.") - #re_GameInfo = re.compile(""" - #PartyPoker\sGame\s\#(?P[0-9]+):\s+ - #(Tournament\s\# # open paren of tournament info - #(?P\d+),\s - #(?P[%(LS)s\+\d\.]+ # here's how I plan to use LS - #\s?(?P%(LEGAL_ISO)s)? - #)\s)? # close paren of tournament info - #(?PHORSE|8\-Game|HOSE)?\s?\(? - #(?PHold\'em|Razz|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball)\s - #(?PNo\sLimit|Limit|Pot\sLimit)\)?,?\s - #(-\sLevel\s(?P[IVXLC]+)\s)? - #\(? # open paren of the stakes - #(?P%(LS)s|)? - #(?P[.0-9]+)/(%(LS)s)? - #(?P[.0-9]+) - #\s?(?P%(LEGAL_ISO)s)? - #\)\s-\s # close paren of the stakes - #(?P.*$)""" % substitutions, - #re.MULTILINE|re.VERBOSE) re_PlayerInfo = re.compile(""" Seat\s(?P\d+):\s @@ -96,11 +77,6 @@ class PartyPoker(HandHistoryConverter): \(\s*\$?(?P[0-9,.]+)\s*(?:USD|)\s*\) """ , re.VERBOSE) - #re_PlayerInfo = re.compile(""" - #^Seat\s(?P[0-9]+):\s - #(?P.*)\s - #\((%(LS)s)?(?P[.0-9]+)\sin\schips\)""" % substitutions, - #re.MULTILINE|re.VERBOSE) re_HandInfo = re.compile(""" ^Table\s+ @@ -111,12 +87,6 @@ class PartyPoker(HandHistoryConverter): Seat\s+(?P