From 86d350984e07a87edf39e8a7640be1d44639f1a4 Mon Sep 17 00:00:00 2001 From: Worros Date: Sun, 22 Mar 2009 01:31:36 +0900 Subject: [PATCH 1/6] Dodgy 6 max fix to FTP converter --- pyfpdb/FulltiltToFpdb.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index fb2bf6ea..b28d4065 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -117,6 +117,9 @@ follow : whether to tail -f the input""" hand.handid = m.group('HID') hand.tablename = m.group('TABLE') hand.starttime = time.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d") + if m.group('TABLEATTRIBUTES'): + m2 = re.search("(\d+) max", m.group('TABLEATTRIBUTES')) + hand.maxseats = int(m2.group(1)) # These work, but the info is already in the Hand class - should be used for tourneys though. # m.group('SB') # m.group('BB') From 8ebcd7b68a4f5b37ea1d7e593526e6d015330f5f Mon Sep 17 00:00:00 2001 From: Worros Date: Sun, 22 Mar 2009 02:17:48 +0900 Subject: [PATCH 2/6] Fix crash on Stars tourney import If importing a tourney and the line was marked as crap this test crashed the importer --- pyfpdb/fpdb_simple.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index fc6c13b2..b0263888 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -714,7 +714,7 @@ def filterCrap(site, hand, isTourney): hand[i] = False elif (hand[i].find(": ")!=-1 and site=="ftp" and hand[i].find("Seat ")==-1 and hand[i].find(": Table")==-1): #filter ftp chat hand[i] = False - if isTourney: + if isTourney and not hand[i] == False: if (hand[i].endswith(" is sitting out") and (not hand[i].startswith("Seat "))): hand[i] = False elif hand[i]: From 38b0fc71577182fcc8e0333e9f9ae175a9be020c Mon Sep 17 00:00:00 2001 From: Worros Date: Sun, 22 Mar 2009 02:20:56 +0900 Subject: [PATCH 3/6] Add all functional site importers to Bulk import gui --- pyfpdb/GuiBulkImport.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py index 6745e9fc..84ef4645 100755 --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -176,7 +176,10 @@ class GuiBulkImport(): # ComboBox - filter self.cbfilter = gtk.combo_box_new_text() self.cbfilter.append_text("passthrough") - self.cbfilter.append_text("Everleaf") + self.cbfilter.append_text("BetfairToFpdb") + self.cbfilter.append_text("EverleafToFpdb") + self.cbfilter.append_text("FulltiltToFpdb") + self.cbfilter.append_text("PokerStarsToFpdb") self.cbfilter.set_active(0) self.table.attach(self.cbfilter, 3, 4, 2, 3, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK) self.cbfilter.show() From 2747b079eddfe65ae46826b41466e2678fc1eab8 Mon Sep 17 00:00:00 2001 From: Worros Date: Sun, 22 Mar 2009 02:52:41 +0900 Subject: [PATCH 4/6] Fix saveActions to True by default --- pyfpdb/fpdb_save_to_db.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyfpdb/fpdb_save_to_db.py b/pyfpdb/fpdb_save_to_db.py index dc2418cf..7a5c7d6d 100644 --- a/pyfpdb/fpdb_save_to_db.py +++ b/pyfpdb/fpdb_save_to_db.py @@ -28,7 +28,7 @@ SQLITE = 4 fastStoreHudCache = True # set this to True to test the new storeHudCache routine -saveActions = False # set this to False to avoid storing action data +saveActions = True # set this to False to avoid storing action data # Pros: speeds up imports # Cons: no action data is saved, so you need to keep the hand histories # variance not available on stats page @@ -70,8 +70,10 @@ def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no, """stores a holdem/omaha hand into the database""" import_options = config.get_import_parameters() - saveActions = True if import_options['saveActions'] == 'True' else False - fastStoreHudCache = True if import_options['fastStoreHudCache'] == 'True' else False + saveActions = False if import_options['saveActions'] == 'False' else True + fastStoreHudCache = False if import_options['fastStoreHudCache'] == 'False' else True + + print "DEBUG: saveActions = '%s' fastStoreHudCache = '%s'"%(saveActions, fastStoreHudCache) t0 = time() fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits) From 999a2b9b5fcd3221f947f153e83ddb269726a0f0 Mon Sep 17 00:00:00 2001 From: Worros Date: Sun, 22 Mar 2009 02:57:37 +0900 Subject: [PATCH 5/6] Remove debug statement --- pyfpdb/fpdb_save_to_db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb_save_to_db.py b/pyfpdb/fpdb_save_to_db.py index 7a5c7d6d..01bd71cc 100644 --- a/pyfpdb/fpdb_save_to_db.py +++ b/pyfpdb/fpdb_save_to_db.py @@ -73,7 +73,7 @@ def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no, saveActions = False if import_options['saveActions'] == 'False' else True fastStoreHudCache = False if import_options['fastStoreHudCache'] == 'False' else True - print "DEBUG: saveActions = '%s' fastStoreHudCache = '%s'"%(saveActions, fastStoreHudCache) + # print "DEBUG: saveActions = '%s' fastStoreHudCache = '%s'"%(saveActions, fastStoreHudCache) t0 = time() fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits) From 208176077e847d555a3ad70a80a17b072d2f2ee9 Mon Sep 17 00:00:00 2001 From: Worros Date: Sun, 22 Mar 2009 02:59:47 +0900 Subject: [PATCH 6/6] Add test code for executemany function --- pyfpdb/fpdb_simple.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index b0263888..7f241a2c 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -29,6 +29,8 @@ MYSQL_INNODB = 2 PGSQL = 3 SQLITE = 4 +DBTEST = False + # Data Structures for index and foreign key creation # drop_code is an int with possible values: 0 - don't drop for bulk import # 1 - drop during bulk import @@ -1511,11 +1513,18 @@ def storeActions(cursor, handsPlayersIds, actionTypes, allIns, actionAmounts, ac #stores into table hands_actions #print "start of storeActions, actionNos:",actionNos #print " action_amounts:",action_amounts + inserts = [] for i in xrange(len(actionTypes)): #iterate through streets for j in xrange(len(actionTypes[i])): #iterate through names for k in xrange(len(actionTypes[i][j])): #iterate through individual actions of that player on that street - cursor.execute ("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)" - , (handsPlayersIds[j], i, actionNos[i][j][k], actionTypes[i][j][k], allIns[i][j][k], actionAmounts[i][j][k])) + if DBTEST == False: + cursor.execute("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)", (handsPlayersIds[j], i, actionNos[i][j][k], actionTypes[i][j][k], allIns[i][j][k], actionAmounts[i][j][k])) + else: + # Add inserts into a list and let + inserts = inserts + [(handsPlayersIds[j], i, actionNos[i][j][k], actionTypes[i][j][k], allIns[i][j][k], actionAmounts[i][j][k])] + + if DBTEST == True: + cursor.executemany("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)", inserts) #end def storeActions def store_board_cards(cursor, hands_id, board_values, board_suits):