diff --git a/pyfpdb/BetfairToFpdb.py b/pyfpdb/BetfairToFpdb.py index 38aa6dc1..d30b3b8e 100755 --- a/pyfpdb/BetfairToFpdb.py +++ b/pyfpdb/BetfairToFpdb.py @@ -37,7 +37,7 @@ class Betfair(HandHistoryConverter): # Static regexes re_GameInfo = re.compile("^(?PNL|PL|) (?P\$|)?(?P[.0-9]+)/\$?(?P[.0-9]+) (?P(Texas Hold\'em|Omaha Hi|Omaha|Razz))", re.MULTILINE) re_SplitHands = re.compile(r'\n\n+') - re_HandInfo = re.compile("\*\*\*\*\* Betfair Poker Hand History for Game (?P[0-9]+) \*\*\*\*\*\n(?PNL|PL|) (?P\$|)?(?P[.0-9]+)/\$?(?P[.0-9]+) (?P(Texas Hold\'em|Omaha Hi|Razz)) - (?P[a-zA-Z]+, [a-zA-Z]+ \d+, \d\d:\d\d:\d\d GMT \d\d\d\d)\nTable (?P[ a-zA-Z0-9]+) \d-max \(Real Money\)\nSeat (?P
[ a-zA-Z0-9]+) \d-max \(Real Money\)\nSeat (?P
[\'\w\s]+)\s\[\d+\]\s\( ( (?PNO_LIMIT|Limit|LIMIT|Pot\sLimit)\s - (?PTEXAS_HOLDEM|RAZZ)\s + (?PTEXAS_HOLDEM|OMAHA_HI|SEVEN_CARD_STUD|SEVEN_CARD_STUD_HI_LO|RAZZ|FIVE_CARD_DRAW)\s (%(LS)s)?(?P[.0-9]+)/ (%(LS)s)?(?P[.0-9]+) )? @@ -156,6 +156,7 @@ class OnGame(HandHistoryConverter): ["ring", "hold", "fl"], ["ring", "hold", "nl"], ["ring", "stud", "fl"], + ["ring", "draw", "fl"], ] def determineGameType(self, handText): @@ -239,18 +240,24 @@ class OnGame(HandHistoryConverter): hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH')) def markStreets(self, hand): - # PREFLOP = ** Dealing down cards ** - # This re fails if, say, river is missing; then we don't get the ** that starts the river. - #m = re.search('(\*\* Dealing down cards \*\*\n)(?P.*?\n\*\*)?( Dealing Flop \*\* \[ (?P\S\S), (?P\S\S), (?P\S\S) \])?(?P.*?\*\*)?( Dealing Turn \*\* \[ (?P\S\S) \])?(?P.*?\*\*)?( Dealing River \*\* \[ (?P\S\S) \])?(?P.*)', hand.string,re.DOTALL) - - #if hand.gametype['base'] in ("hold"): - #elif hand.gametype['base'] in ("stud"): - #elif hand.gametype['base'] in ("draw"): - # only holdem so far: - m = re.search(r"pocket cards(?P.+(?= Dealing flop )|.+(?=Summary))" + if hand.gametype['base'] in ("hold"): + m = re.search(r"pocket cards(?P.+(?= Dealing flop )|.+(?=Summary))" r"( Dealing flop (?P\[\S\S, \S\S, \S\S\].+(?= Dealing turn)|.+(?=Summary)))?" r"( Dealing turn (?P\[\S\S\].+(?= Dealing river)|.+(?=Summary)))?" r"( Dealing river (?P\[\S\S\].+(?=Summary)))?", hand.handText, re.DOTALL) + elif hand.gametype['base'] in ("stud"): + m = re.search(r"(?P.+(?=Dealing pocket cards)|.+)" + r"(Dealing pocket cards(?P.+(?=Dealing 4th street)|.+))?" + r"(Dealing 4th street(?P.+(?=Dealing 5th street)|.+))?" + r"(Dealing 5th street(?P.+(?=Dealing 6th street)|.+))?" + r"(Dealing 6th street(?P.+(?=Dealing river)|.+))?" + r"(Dealing river(?P.+))?", hand.handText,re.DOTALL) + elif hand.gametype['base'] in ("draw"): + m = re.search(r"(?P.+(?=Dealing pocket cards)|.+)" + r"(Dealing pocket cards(?P.+(?=\*\*\* FIRST DRAW \*\*\*)|.+))?" + r"(\*\*\* FIRST DRAW \*\*\*(?P.+(?=\*\*\* SECOND DRAW \*\*\*)|.+))?" + r"(\*\*\* SECOND DRAW \*\*\*(?P.+(?=\*\*\* THIRD DRAW \*\*\*)|.+))?" + r"(\*\*\* THIRD DRAW \*\*\*(?P.+))?", hand.handText,re.DOTALL) hand.addStreets(m) @@ -311,10 +318,10 @@ class OnGame(HandHistoryConverter): for street in ('PREFLOP', 'DEAL'): if street in hand.streets.keys(): m = self.re_HeroCards.finditer(hand.streets[street]) - for found in m: - hand.hero = found.group('PNAME') - newcards = found.group('CARDS').split(', ') - hand.addHoleCards(street, hand.hero, closed=newcards, shown=False, mucked=False, dealt=True) + for found in m: + hand.hero = found.group('PNAME') + newcards = found.group('CARDS').split(', ') + hand.addHoleCards(street, hand.hero, closed=newcards, shown=False, mucked=False, dealt=True) def readAction(self, hand, street): m = self.re_Action.finditer(hand.streets[street]) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 25dd36e5..7d2931a7 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -162,13 +162,13 @@ class Sql: self.query['createActionsTable'] = """CREATE TABLE Actions ( id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), name varchar(32) NOT NULL, - code char(2) NOT NULL) + code char(4) NOT NULL) ENGINE=INNODB""" elif db_server == 'postgresql': self.query['createActionsTable'] = """CREATE TABLE Actions ( id SERIAL, PRIMARY KEY (id), name varchar(32), - code char(2))""" + code char(4))""" elif db_server == 'sqlite': self.query['createActionsTable'] = """CREATE TABLE Actions ( id INTEGER PRIMARY KEY, @@ -1011,7 +1011,7 @@ class Sql: street SMALLINT NOT NULL, actionNo SMALLINT NOT NULL, streetActionNo SMALLINT NOT NULL, - actionId SMALLINT NOT NULL, FOREIGN KEY (actionId) REFERENCES Actions(id), + actionId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (actionId) REFERENCES Actions(id), amount INT NOT NULL, raiseTo INT NOT NULL, amountCalled INT NOT NULL, diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index cea95321..4c055bd1 100755 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -239,7 +239,7 @@ class Importer: if self.settings['dropIndexes'] == 'drop': self.database.prepareBulkImport() else: - log.debug(_("No need to drop indexes.")) + log.info(_("No need to drop indexes.")) #print "dropInd =", self.settings['dropIndexes'], " dropHudCache =", self.settings['dropHudCache'] if self.settings['threads'] <= 0: @@ -277,11 +277,11 @@ class Importer: if self.settings['dropIndexes'] == 'drop': self.database.afterBulkImport() else: - print _("No need to rebuild indexes.") + log.info (_("No need to rebuild indexes.")) if 'dropHudCache' in self.settings and self.settings['dropHudCache'] == 'drop': self.database.rebuild_hudcache() else: - print _("No need to rebuild hudcache.") + log.info (_("No need to rebuild hudcache.")) self.database.analyzeDB() endtime = time() return (totstored, totdups, totpartial, toterrors, endtime-starttime)