From 1fc015b09fe4fbc3c1a8b5c3e5108e2f401a2621 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 14 Oct 2009 12:05:17 +0800 Subject: [PATCH 01/10] [NEWIMPORT] Move db insert into SQL.py (store_hand) --- pyfpdb/Database.py | 36 +----------------------------------- pyfpdb/SQL.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index f0146c7f..72083819 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1383,41 +1383,7 @@ class Database: def storeHand(self, p): #stores into table hands: - q = """INSERT INTO Hands ( - tablename, - gametypeid, - sitehandno, - handstart, - importtime, - seats, - maxseats, - texture, - playersVpi, - boardcard1, - boardcard2, - boardcard3, - boardcard4, - boardcard5, - playersAtStreet1, - playersAtStreet2, - playersAtStreet3, - playersAtStreet4, - playersAtShowdown, - street0Raises, - street1Raises, - street2Raises, - street3Raises, - street4Raises, - street1Pot, - street2Pot, - street3Pot, - street4Pot, - showdownPot - ) - VALUES - (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, - %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, - %s, %s, %s, %s, %s, %s, %s, %s, %s)""" + q = self.sql.query['store_hand'] q = q.replace('%s', self.sql.query['placeholder']) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 0f414e41..12df7aa4 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -3110,6 +3110,44 @@ class Sql: self.query['handsPlayersTTypeId_joiner'] = " OR TourneysPlayersId+0=" self.query['handsPlayersTTypeId_joiner_id'] = " OR id=" + self.query['store_hand'] = """INSERT INTO Hands ( + tablename, + gametypeid, + sitehandno, + handstart, + importtime, + seats, + maxseats, + texture, + playersVpi, + boardcard1, + boardcard2, + boardcard3, + boardcard4, + boardcard5, + playersAtStreet1, + playersAtStreet2, + playersAtStreet3, + playersAtStreet4, + playersAtShowdown, + street0Raises, + street1Raises, + street2Raises, + street3Raises, + street4Raises, + street1Pot, + street2Pot, + street3Pot, + street4Pot, + showdownPot + ) + VALUES + (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, + %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, + %s, %s, %s, %s, %s, %s, %s, %s, %s)""" + + + if db_server == 'mysql': From 2350474d38257efdf4111e96d1ee3084611555e6 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 14 Oct 2009 20:20:17 +0800 Subject: [PATCH 02/10] [NEWIMPORT] Start of HandsPlayers insert --- pyfpdb/Database.py | 102 +++++++---------------------------------- pyfpdb/DerivedStats.py | 13 +++++- pyfpdb/Hand.py | 4 +- 3 files changed, 32 insertions(+), 87 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index ac2ea49e..e80c4694 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1421,19 +1421,29 @@ class Database: p['street4Pot'], p['showdownPot'] )) - #return getLastInsertId(backend, conn, cursor) + return self.get_last_insert_id(self.cursor) # def storeHand - def storeHandsPlayers(self, hid, pid, p): + def storeHandsPlayers(self, hid, pids, pdata): + #print "DEBUG: %s %s %s" %(hid, pids, pdata) + inserts = [] + for p in pdata: + inserts.append( (hid, + pids[p], + pdata[p]['startCash'], + pdata[p]['seatNo'] + ) ) + q = """INSERT INTO HandsPlayers ( handId, - playerId + playerId, + startCash, + seatNo ) VALUES ( - %s, %s + %s, %s, %s, %s )""" -# startCash, # position, # tourneyTypeId, # card1, @@ -1443,7 +1453,6 @@ class Database: # startCards, # winnings, # rake, -# seatNo, # totalProfit, # street0VPI, # street0Aggr, @@ -1511,85 +1520,8 @@ class Database: q = q.replace('%s', self.sql.query['placeholder']) - self.cursor.execute(q, ( - hid, - pid - )) -# startCash, -# position, -# tourneyTypeId, -# card1, -# card2, -# card3, -# card4, -# startCards, -# winnings, -# rake, -# seatNo, -# totalProfit, -# street0VPI, -# street0Aggr, -# street0_3BChance, -# street0_3BDone, -# street1Seen, -# street2Seen, -# street3Seen, -# street4Seen, -# sawShowdown, -# street1Aggr, -# street2Aggr, -# street3Aggr, -# street4Aggr, -# otherRaisedStreet1, -# otherRaisedStreet2, -# otherRaisedStreet3, -# otherRaisedStreet4, -# foldToOtherRaisedStreet1, -# foldToOtherRaisedStreet2, -# foldToOtherRaisedStreet3, -# foldToOtherRaisedStreet4, -# wonWhenSeenStreet1, -# wonAtSD, -# stealAttemptChance, -# stealAttempted, -# foldBbToStealChance, -# foldedBbToSteal, -# foldSbToStealChance, -# foldedSbToSteal, -# street1CBChance, -# street1CBDone, -# street2CBChance, -# street2CBDone, -# street3CBChance, -# street3CBDone, -# street4CBChance, -# street4CBDone, -# foldToStreet1CBChance, -# foldToStreet1CBDone, -# foldToStreet2CBChance, -# foldToStreet2CBDone, -# foldToStreet3CBChance, -# foldToStreet3CBDone, -# foldToStreet4CBChance, -# foldToStreet4CBDone, -# street1CheckCallRaiseChance, -# street1CheckCallRaiseDone, -# street2CheckCallRaiseChance, -# street2CheckCallRaiseDone, -# street3CheckCallRaiseChance, -# street3CheckCallRaiseDone, -# street4CheckCallRaiseChance, -# street4CheckCallRaiseDone, -# street0Calls, -# street1Calls, -# street2Calls, -# street3Calls, -# street4Calls, -# street0Bets, -# street1Bets, -# street2Bets, -# street3Bets, -# street4Bets + #print "DEBUG: inserts: %s" %inserts + self.cursor.executemany(q, inserts) def storeHudCacheNew(self, gid, pid, hc): q = """INSERT INTO HudCache ( diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 315ae707..fd4ffd0e 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -39,6 +39,9 @@ class DerivedStats(): def getHands(self): return self.hands + def getHandsPlayers(self): + return self.handsplayers + def assembleHands(self, hand): self.hands['tableName'] = hand.tablename self.hands['siteHandNo'] = hand.handid @@ -77,10 +80,18 @@ class DerivedStats(): # commentTs DATETIME def assembleHandsPlayers(self, hand): - self.vpip(self.hand) + #self.vpip(self.hand) + + #hand.players = [[seat, name, chips],[seat, name, chips]] + for player in hand.players: + self.handsplayers[player[1]] = {} + self.handsplayers[player[1]]['seatNo'] = player[0] + self.handsplayers[player[1]]['startCash'] = player[2] + for i, street in enumerate(hand.actionStreets[1:]): self.aggr(self.hand, i) + def assembleHudCache(self, hand): # # def generateHudCacheData(player_ids, base, category, action_types, allIns, actionTypeByNo # # ,winnings, totalWinnings, positions, actionTypes, actionAmounts, antes): diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 2527f636..d8dc1889 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -206,13 +206,14 @@ db: a connected fpdb_db object""" gtid = db.getGameTypeId(self.siteId, self.gametype) self.stats.assembleHands(self) + self.stats.assembleHandsPlayers(self) ##### # End prep functions ##### - # HudCache data to come from DerivedStats class # HandsActions - all actions for all players for all streets - self.actions + # HudCache data can be generated from HandsActions (HandsPlayers?) # Hands - Summary information of hand indexed by handId - gameinfo hh = self.stats.getHands() @@ -223,6 +224,7 @@ db: a connected fpdb_db object""" #print hh handid = db.storeHand(hh) # HandsPlayers - ? ... Do we fix winnings? + db.storeHandsPlayers(handid, sqlids, self.stats.getHandsPlayers()) # Tourneys ? # TourneysPlayers From 7b2c1fa24300661e8b82fd9c40f016749a63d8a2 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 14 Oct 2009 20:28:07 +0800 Subject: [PATCH 03/10] [NEWIMPORT] Minor update, use DerivedStats.getStats() --- pyfpdb/DerivedStats.py | 15 ++++++--------- pyfpdb/Hand.py | 3 +-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index fd4ffd0e..5f0d2aff 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -80,11 +80,8 @@ class DerivedStats(): # commentTs DATETIME def assembleHandsPlayers(self, hand): - #self.vpip(self.hand) - #hand.players = [[seat, name, chips],[seat, name, chips]] for player in hand.players: - self.handsplayers[player[1]] = {} self.handsplayers[player[1]]['seatNo'] = player[0] self.handsplayers[player[1]]['startCash'] = player[2] @@ -788,14 +785,14 @@ class DerivedStats(): if act[1] in ('calls','bets', 'raises'): vpipers.add(act[0]) - #for player in hand.players: - # print "DEBUG: '%s' '%s' '%s'" %(player, player[1], vpipers) - # if player[1] in vpipers: - # self.handsplayers[player[1]]['vpip'] = True - # else: - # self.handsplayers[player[1]]['vpip'] = False self.hands['playersVpi'] = len(vpipers) + for player in hand.players: + if player[1] in vpipers: + self.handsplayers[player[1]]['vpip'] = True + else: + self.handsplayers[player[1]]['vpip'] = False + def playersAtStreetX(self, hand): """ playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4/draw1 */""" # self.actions[street] is a list of all actions in a tuple, contining the player name first diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index d8dc1889..602a6a1a 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -205,8 +205,7 @@ db: a connected fpdb_db object""" #Gametypes gtid = db.getGameTypeId(self.siteId, self.gametype) - self.stats.assembleHands(self) - self.stats.assembleHandsPlayers(self) + self.stats.getStats(self) ##### # End prep functions From a232a94eb1d36f59b79c8b67682b1572633661f3 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Wed, 14 Oct 2009 16:04:09 +0300 Subject: [PATCH 04/10] Try to make hud more configurable Modified files: * Configuration.py * HUD_config.xml.example * HUD_main.py Instead of tweaking aggregation settings directly in code, make the values configurable through HUD_config.xml; use the newly created element for this. Retain coding convention and key-value names as they are. --- pyfpdb/Configuration.py | 47 ++++++++++++++++++ pyfpdb/HUD_config.xml.example | 93 ++++++++++++++++++++++++++++++++++- pyfpdb/HUD_main.py | 2 +- 3 files changed, 139 insertions(+), 3 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 89f4fb29..7f0f937e 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -282,6 +282,19 @@ class HudUI: def __init__(self, node): self.node = node self.label = node.getAttribute('label') + # + self.aggregate_ring = fix_tf(node.getAttribute('aggregate_ring_game_stats')) + self.aggregate_tour = fix_tf(node.getAttribute('aggregate_tourney_stats')) + self.hud_style = node.getAttribute('stat_aggregation_range') + self.hud_days = node.getAttribute('aggregation_days') + self.agg_bb_mult = node.getAttribute('aggregation_level_multiplier') + # + self.h_aggregate_ring = fix_tf(node.getAttribute('aggregate_hero_ring_game_stats')) + self.h_aggregate_tour = fix_tf(node.getAttribute('aggregate_hero_tourney_stats')) + self.h_hud_style = node.getAttribute('hero_stat_aggregation_range') + self.h_hud_days = node.getAttribute('hero_aggregation_days') + self.h_agg_bb_mult = node.getAttribute('hero_aggregation_level_multiplier') + def __str__(self): return " label = %s\n" % self.label @@ -629,6 +642,7 @@ class Config: # Allow to change the menu appearance def get_hud_ui_parameters(self): hui = {} + default_text = 'FPDB Menu - Right click\nLeft-Drag to Move' try: hui['label'] = self.ui.label @@ -636,6 +650,39 @@ class Config: hui['label'] = default_text except: hui['label'] = default_text + + try: hui['aggregate_ring'] = self.ui.aggregate_ring + except: hui['aggregate_ring'] = False + + try: hui['aggregate_tour'] = self.ui.aggregate_tour + except: hui['aggregate_tour'] = True + + try: hui['hud_style'] = self.ui.hud_style + except: hui['hud_style'] = 'A' + + try: hui['hud_days'] = self.ui.hud_days + except: hui['hud_days'] = 90 + + try: hui['agg_bb_mult'] = self.ui.agg_bb_mult + except: hui['agg_bb_mult'] = 1 + + # Hero specific + + try: hui['h_aggregate_ring'] = self.ui.h_aggregate_ring + except: hui['h_aggregate_ring'] = False + + try: hui['h_aggregate_tour'] = self.ui.h_aggregate_tour + except: hui['h_aggregate_tour'] = True + + try: hui['h_hud_style'] = self.ui.h_hud_style + except: hui['h_hud_style'] = 'S' + + try: hui['h_hud_days'] = self.ui.h_hud_days + except: hui['h_hud_days'] = 30 + + try: hui['h_agg_bb_mult'] = self.ui.h_agg_bb_mult + except: hui['h_agg_bb_mult'] = 1 + return hui diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index de2f1bba..1fe19c5a 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -4,8 +4,97 @@ - + + + diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py index 23c1ef03..95a25a29 100755 --- a/pyfpdb/HUD_main.py +++ b/pyfpdb/HUD_main.py @@ -91,7 +91,7 @@ class HUD_main(object): self.db_name = db_name self.config = Configuration.Config(file=options.config, dbname=options.dbname) self.hud_dict = {} - self.hud_params = def_hud_params + self.hud_params = self.config.get_hud_ui_parameters() # a thread to read stdin gobject.threads_init() # this is required From 16d1f43c7e34c7be3e0452a8ae82b36ddd728ce3 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 14 Oct 2009 23:55:51 +0800 Subject: [PATCH 05/10] [NEWIMPORT] HandsPlayers.streetXAggr insert. --- pyfpdb/Database.py | 20 +++++++++++++------- pyfpdb/DerivedStats.py | 2 ++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index e80c4694..d25b309c 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1431,16 +1431,27 @@ class Database: inserts.append( (hid, pids[p], pdata[p]['startCash'], - pdata[p]['seatNo'] + pdata[p]['seatNo'], + pdata[p]['street0Aggr'], + pdata[p]['street1Aggr'], + pdata[p]['street2Aggr'], + pdata[p]['street3Aggr'], + pdata[p]['street4Aggr'] ) ) q = """INSERT INTO HandsPlayers ( handId, playerId, startCash, - seatNo + seatNo, + street0Aggr, + street1Aggr, + street2Aggr, + street3Aggr, + street4Aggr ) VALUES ( + %s, %s, %s, %s, %s, %s, %s, %s, %s )""" @@ -1455,7 +1466,6 @@ class Database: # rake, # totalProfit, # street0VPI, -# street0Aggr, # street0_3BChance, # street0_3BDone, # street1Seen, @@ -1463,10 +1473,6 @@ class Database: # street3Seen, # street4Seen, # sawShowdown, -# street1Aggr, -# street2Aggr, -# street3Aggr, -# street4Aggr, # otherRaisedStreet1, # otherRaisedStreet2, # otherRaisedStreet3, diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 5f0d2aff..5b69bbfb 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -29,6 +29,8 @@ class DerivedStats(): for player in hand.players: self.handsplayers[player[1]] = {} + #Init vars that may not be used, but still need to be inserted. + self.handsplayers[player[1]]['street4Aggr'] = False self.assembleHands(self.hand) self.assembleHandsPlayers(self.hand) From 54d309f797d68a6b629ecbb278431fd25e50865e Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Wed, 14 Oct 2009 19:33:19 +0300 Subject: [PATCH 06/10] Minor fixes to hud setup code --- pyfpdb/Configuration.py | 4 ++-- pyfpdb/HUD_config.xml.example | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 7f0f937e..924d6584 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -660,7 +660,7 @@ class Config: try: hui['hud_style'] = self.ui.hud_style except: hui['hud_style'] = 'A' - try: hui['hud_days'] = self.ui.hud_days + try: hui['hud_days'] = int(self.ui.hud_days) except: hui['hud_days'] = 90 try: hui['agg_bb_mult'] = self.ui.agg_bb_mult @@ -677,7 +677,7 @@ class Config: try: hui['h_hud_style'] = self.ui.h_hud_style except: hui['h_hud_style'] = 'S' - try: hui['h_hud_days'] = self.ui.h_hud_days + try: hui['h_hud_days'] = int(self.ui.h_hud_days) except: hui['h_hud_days'] = 30 try: hui['h_agg_bb_mult'] = self.ui.h_agg_bb_mult diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index 1fe19c5a..bfeafd8d 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -82,7 +82,7 @@ Date: Thu, 15 Oct 2009 11:57:42 +0800 Subject: [PATCH 07/10] Make GuiBulkImport allow multi-file select --- pyfpdb/GuiBulkImport.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py index 21f9e050..de8580df 100755 --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -40,21 +40,6 @@ class GuiBulkImport(): # CONFIGURATION - update these as preferred: allowThreads = True # set to True to try out the threads field - # not used - def import_dir(self): - """imports a directory, non-recursive. todo: move this to fpdb_import so CLI can use it""" - - self.path = self.inputFile - self.importer.addImportDirectory(self.path) - self.importer.setCallHud(False) - starttime = time() - if not self.importer.settings['threads'] > 1: - (stored, dups, partial, errs, ttime) = self.importer.runImport() - print 'GuiBulkImport.import_dir done: Stored: %d Duplicates: %d Partial: %d Errors: %d in %s seconds - %d/sec'\ - % (stored, dups, partial, errs, ttime, stored / ttime) - else: - self.importer.RunImportThreaded() - def dopulse(self): self.progressbar.pulse() return True @@ -77,7 +62,7 @@ class GuiBulkImport(): self.timer = gobject.timeout_add(100, self.dopulse) # get the dir to import from the chooser - self.inputFile = self.chooser.get_filename() + selected = self.chooser.get_filenames() # get the import settings from the gui and save in the importer self.importer.setHandCount(int(self.spin_hands.get_text())) @@ -103,7 +88,8 @@ class GuiBulkImport(): self.importer.setDropHudCache("auto") sitename = self.cbfilter.get_model()[self.cbfilter.get_active()][0] - self.importer.addBulkImportImportFileOrDir(self.inputFile, site = sitename) + for selection in selected: + self.importer.addBulkImportImportFileOrDir(selection, site = sitename) self.importer.setCallHud(False) starttime = time() # try: @@ -151,6 +137,7 @@ class GuiBulkImport(): self.chooser = gtk.FileChooserWidget() self.chooser.set_filename(self.settings['bulkImport-defaultPath']) + self.chooser.set_select_multiple(True) self.vbox.add(self.chooser) self.chooser.show() From 7a9237b70773ffb0a50ffd4c9a12991ea83a0d91 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 15 Oct 2009 15:12:08 +0800 Subject: [PATCH 08/10] GuiBulkImport - make cli version print out import stats --- pyfpdb/GuiBulkImport.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py index de8580df..667e4d6c 100755 --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -337,8 +337,10 @@ def main(argv=None): importer.setThreads(-1) importer.addBulkImportImportFileOrDir(os.path.expanduser(options.filename), site=options.filtername) importer.setCallHud(False) - importer.runImport() + (stored, dups, partial, errs, ttime) = importer.runImport() importer.clearFileList() + print 'GuiBulkImport done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %.0f/sec'\ + % (stored, dups, partial, errs, ttime, (stored+0.0) / ttime) if __name__ == '__main__': From c3bc165a902e13321f834cfc554d749523a8a5ca Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 15 Oct 2009 15:13:09 +0800 Subject: [PATCH 09/10] Add comment to DerivedStats --- pyfpdb/DerivedStats.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 5b69bbfb..106bd038 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -801,6 +801,8 @@ class DerivedStats(): # [ (player, action, ....), (player2, action, ...) ] # The number of unique players in the list per street gives the value for playersAtStreetXXX + # FIXME?? - This isn't couting people that are all in - at least showdown needs to reflect this + self.hands['playersAtStreet1'] = 0 self.hands['playersAtStreet2'] = 0 self.hands['playersAtStreet3'] = 0 From ceaa78bdc80677adff393f6abb263c61e99ca765 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 15 Oct 2009 15:23:47 +0800 Subject: [PATCH 10/10] Add usage message to GuiBulkImport cli I keep forgetting the format for Full Tilt cli import --- pyfpdb/GuiBulkImport.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py index 667e4d6c..9cb54d50 100755 --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -304,8 +304,20 @@ def main(argv=None): help="If this option is passed it quits when it encounters any error") parser.add_option("-m", "--minPrint", "--status", dest="minPrint", default="0", type="int", help="How often to print a one-line status report (0 (default) means never)") + parser.add_option("-u", "--usage", action="store_true", dest="usage", default=False, + help="Print some useful one liners") (options, sys.argv) = parser.parse_args(args = argv) + if options.usage == True: + #Print usage examples and exit + print "USAGE:" + print 'PokerStars converter: ./GuiBulkImport -c PokerStars -f filename' + print 'Full Tilt converter: ./GuiBulkImport -c "Full Tilt Poker" -f filename' + print "Everleaf converter: ./GuiBulkImport -c Everleaf -f filename" + print "Absolute converter: ./GuiBulkImport -c Absolute -f filename" + print "PartyPoker converter: ./GuiBulkImport -c PartyPoker -f filename" + sys.exit(0) + config = Configuration.Config() settings = {}