Merge branch 'master' of git://git.assembla.com/fpdb-eric
This commit is contained in:
		
						commit
						e99ec0cd71
					
				|  | @ -213,7 +213,7 @@ if __name__ == '__main__': | ||||||
|     parser = OptionParser() |     parser = OptionParser() | ||||||
|     parser.add_option("-f", "--file", dest="filename", help="Input file in quiet mode", metavar="FILE") |     parser.add_option("-f", "--file", dest="filename", help="Input file in quiet mode", metavar="FILE") | ||||||
|     parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True, help="don't start gui") |     parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True, help="don't start gui") | ||||||
| 
 |     parser.add_option("-x", "--convert", dest="filtername", help="Conversion filter", default="passthrough") | ||||||
|     (options, sys.argv) = parser.parse_args() |     (options, sys.argv) = parser.parse_args() | ||||||
| 
 | 
 | ||||||
|     config = Configuration.Config() |     config = Configuration.Config() | ||||||
|  | @ -240,7 +240,7 @@ if __name__ == '__main__': | ||||||
|         importer = fpdb_import.Importer(False,settings, config)  |         importer = fpdb_import.Importer(False,settings, config)  | ||||||
|         importer.setDropIndexes("auto") |         importer.setDropIndexes("auto") | ||||||
|         importer.setFailOnError(True) |         importer.setFailOnError(True) | ||||||
|         importer.addImportFile(options.filename) |         importer.addImportFile(options.filename, filter=options.filtername) | ||||||
|         importer.setCallHud(False) |         importer.setCallHud(False) | ||||||
|         importer.runImport() |         importer.runImport() | ||||||
|         importer.clearFileList() |         importer.clearFileList() | ||||||
|  |  | ||||||
|  | @ -123,7 +123,7 @@ class HUD_main(object): | ||||||
|             gtk.gdk.threads_enter() |             gtk.gdk.threads_enter() | ||||||
|             try: |             try: | ||||||
|                 self.hud_dict[table_name].update(new_hand_id, config) |                 self.hud_dict[table_name].update(new_hand_id, config) | ||||||
|                 map(lambda aw: aw.update_gui(new_hand_id), self.hud_dict[table_name].aux_windows) |                 [aw.update_gui(new_hand_id) for aw in self.hud_dict[table_name].aux_windows] | ||||||
|                 return False |                 return False | ||||||
|             finally: |             finally: | ||||||
|                 gtk.gdk.threads_leave() |                 gtk.gdk.threads_leave() | ||||||
|  | @ -174,8 +174,7 @@ class HUD_main(object): | ||||||
|             if temp_key in self.hud_dict: |             if temp_key in self.hud_dict: | ||||||
|                 self.hud_dict[temp_key].stat_dict = stat_dict |                 self.hud_dict[temp_key].stat_dict = stat_dict | ||||||
|                 self.hud_dict[temp_key].cards = cards |                 self.hud_dict[temp_key].cards = cards | ||||||
|                 for aw in self.hud_dict[temp_key].aux_windows: |                 [aw.update_data(new_hand_id, self.db_connection) for aw in self.hud_dict[temp_key].aux_windows] | ||||||
|                     aw.update_data(new_hand_id, self.db_connection) |  | ||||||
|                 self.update_HUD(new_hand_id, temp_key, self.config) |                 self.update_HUD(new_hand_id, temp_key, self.config) | ||||||
|      |      | ||||||
| #    Or create a new HUD | #    Or create a new HUD | ||||||
|  |  | ||||||
|  | @ -178,7 +178,7 @@ If a player has None chips he won't be added.""" | ||||||
|             elif blindtype == 'both': |             elif blindtype == 'both': | ||||||
|                 # extra small blind is 'dead' |                 # extra small blind is 'dead' | ||||||
|                 self.lastBet['PREFLOP'] = Decimal(self.bb) |                 self.lastBet['PREFLOP'] = Decimal(self.bb) | ||||||
|         self.posted = self.posted + [[player,blindtype]] |             self.posted = self.posted + [[player,blindtype]] | ||||||
|         #print "DEBUG: self.posted: %s" %(self.posted) |         #print "DEBUG: self.posted: %s" %(self.posted) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -328,7 +328,7 @@ Map the tuple self.gametype onto the pokerstars string describing it | ||||||
|         # currently it appears to be something like ["ring", "hold", "nl", sb, bb]: |         # currently it appears to be something like ["ring", "hold", "nl", sb, bb]: | ||||||
|         gs = {"holdem"       : "Hold'em", |         gs = {"holdem"       : "Hold'em", | ||||||
|               "omahahi"    : "Omaha", |               "omahahi"    : "Omaha", | ||||||
|               "omahahilo"  : "FIXME", |               "omahahilo"  : "Omaha Hi/Lo", | ||||||
|               "razz"       : "Razz", |               "razz"       : "Razz", | ||||||
|               "studhi"     : "7 Card Stud", |               "studhi"     : "7 Card Stud", | ||||||
|               "studhilo"   : "FIXME", |               "studhilo"   : "FIXME", | ||||||
|  | @ -371,11 +371,11 @@ Map the tuple self.gametype onto the pokerstars string describing it | ||||||
|             print >>fh, _("%s: completes to $%s%s" %(act[0], act[2], ' and is all-in' if act[3] else '')) |             print >>fh, _("%s: completes to $%s%s" %(act[0], act[2], ' and is all-in' if act[3] else '')) | ||||||
|         elif act[1] == 'posts': |         elif act[1] == 'posts': | ||||||
|             if(act[2] == "small blind"): |             if(act[2] == "small blind"): | ||||||
|                 print >>fh, _("%s: posts small blind $%s" %(act[0], act[3])) |                 print >>fh, _("%s: posts small blind $%s%s" %(act[0], act[3], ' and is all-in' if act[4] else '')) | ||||||
|             elif(act[2] == "big blind"): |             elif(act[2] == "big blind"): | ||||||
|                 print >>fh, _("%s: posts big blind $%s" %(act[0], act[3])) |                 print >>fh, _("%s: posts big blind $%s%s" %(act[0], act[3], ' and is all-in' if act[4] else '')) | ||||||
|             elif(act[2] == "both"): |             elif(act[2] == "both"): | ||||||
|                 print >>fh, _("%s: posts small & big blinds $%s" %(act[0], act[3])) |                 print >>fh, _("%s: posts small & big blinds $%s%s" %(act[0], act[3], ' and is all-in' if act[4] else '')) | ||||||
|         elif act[1] == 'bringin': |         elif act[1] == 'bringin': | ||||||
|             print >>fh, _("%s: brings in for $%s%s" %(act[0], act[2], ' and is all-in' if act[3] else '')) |             print >>fh, _("%s: brings in for $%s%s" %(act[0], act[2], ' and is all-in' if act[3] else '')) | ||||||
|         elif act[1] == 'discards': |         elif act[1] == 'discards': | ||||||
|  | @ -458,7 +458,7 @@ Card ranks will be uppercased | ||||||
| 
 | 
 | ||||||
|     def writeHand(self, fh=sys.__stdout__): |     def writeHand(self, fh=sys.__stdout__): | ||||||
|         # PokerStars format. |         # PokerStars format. | ||||||
|         print >>fh, _("%s Game #%s: %s ($%s/$%s) - %s" %("PokerStars", self.handid, self.getGameTypeAsString(), self.sb, self.bb, time.strftime('%Y/%m/%d - %H:%M:%S (ET)', self.starttime))) |         print >>fh, _("%s Game #%s: %s ($%s/$%s) - %s" %("PokerStars", self.handid, self.getGameTypeAsString(), self.sb, self.bb, time.strftime('%Y/%m/%d - %H:%M:%S ET', self.starttime))) | ||||||
|         print >>fh, _("Table '%s' %d-max Seat #%s is the button" %(self.tablename, self.maxseats, self.buttonpos)) |         print >>fh, _("Table '%s' %d-max Seat #%s is the button" %(self.tablename, self.maxseats, self.buttonpos)) | ||||||
|          |          | ||||||
|         players_who_act_preflop = set(([x[0] for x in self.actions['PREFLOP']]+[x[0] for x in self.actions['BLINDSANTES']])) |         players_who_act_preflop = set(([x[0] for x in self.actions['PREFLOP']]+[x[0] for x in self.actions['BLINDSANTES']])) | ||||||
|  | @ -501,10 +501,19 @@ Card ranks will be uppercased | ||||||
|         #Some sites don't have a showdown section so we have to figure out if there should be one |         #Some sites don't have a showdown section so we have to figure out if there should be one | ||||||
|         # The logic for a showdown is: at the end of river action there are at least two players in the hand |         # The logic for a showdown is: at the end of river action there are at least two players in the hand | ||||||
|         # we probably don't need a showdown section in pseudo stars format for our filtering purposes |         # we probably don't need a showdown section in pseudo stars format for our filtering purposes | ||||||
|         if 'SHOWDOWN' in self.actions: |         if self.shown: | ||||||
|             print >>fh, _("*** SHOW DOWN ***") |             print >>fh, _("*** SHOW DOWN ***") | ||||||
|             #TODO: Complete SHOWDOWN |             for name in self.shown: | ||||||
| 
 |                 # TODO: legacy importer can't handle only one holecard here, make sure there are 2 for holdem, 4 for omaha | ||||||
|  |                 # TOOD: If HoldHand subclass supports more than omahahi, omahahilo, holdem, add them here | ||||||
|  |                 numOfHoleCardsNeeded = None | ||||||
|  |                 if self.gametype['category'] in ('omahahi','omahahilo'): | ||||||
|  |                     numOfHoleCardsNeeded = 4 | ||||||
|  |                 elif self.gametype['category'] in ('holdem'): | ||||||
|  |                     numOfHoleCardsNeeded = 2 | ||||||
|  |                 if len(self.holecards[name]['PREFLOP']) == numOfHoleCardsNeeded: | ||||||
|  |                     print >>fh, _("%s shows [%s] (a hand...)" % (name, " ".join(self.holecards[name]['PREFLOP']))) | ||||||
|  |                  | ||||||
|         # Current PS format has the lines: |         # Current PS format has the lines: | ||||||
|         # Uncalled bet ($111.25) returned to s0rrow |         # Uncalled bet ($111.25) returned to s0rrow | ||||||
|         # s0rrow collected $5.15 from side pot |         # s0rrow collected $5.15 from side pot | ||||||
|  | @ -652,14 +661,14 @@ Card ranks will be uppercased | ||||||
| 
 | 
 | ||||||
|     def writeHand(self, fh=sys.__stdout__): |     def writeHand(self, fh=sys.__stdout__): | ||||||
|         # PokerStars format. |         # PokerStars format. | ||||||
|         print >>fh, _("%s Game #%s: %s ($%s/$%s) - %s" %("PokerStars", self.handid, self.getGameTypeAsString(), self.sb, self.bb, time.strftime('%Y/%m/%d - %H:%M:%S (ET)', self.starttime))) |         print >>fh, _("%s Game #%s:  %s ($%s/$%s) - %s" %("PokerStars", self.handid, self.getGameTypeAsString(), self.sb, self.bb, time.strftime('%Y/%m/%d %H:%M:%S ET', self.starttime))) | ||||||
|         print >>fh, _("Table '%s' %d-max Seat #%s is the button" %(self.tablename, self.maxseats, self.buttonpos)) |         print >>fh, _("Table '%s' %d-max Seat #%s is the button" %(self.tablename, self.maxseats, self.buttonpos)) | ||||||
| 
 | 
 | ||||||
|         players_who_act_ondeal = set(([x[0] for x in self.actions['DEAL']]+[x[0] for x in self.actions['BLINDSANTES']])) |         players_who_act_ondeal = set(([x[0] for x in self.actions['DEAL']]+[x[0] for x in self.actions['BLINDSANTES']])) | ||||||
| 
 | 
 | ||||||
|         for player in [x for x in self.players if x[1] in players_who_act_ondeal]: |         for player in [x for x in self.players if x[1] in players_who_act_ondeal]: | ||||||
|             #Only print stacks of players who do something on deal |             #Only print stacks of players who do something on deal | ||||||
|             print >>fh, _("Seat %s: %s ($%s)" %(player[0], player[1], player[2])) |             print >>fh, _("Seat %s: %s ($%s in chips) " %(player[0], player[1], player[2])) | ||||||
| 
 | 
 | ||||||
|         if 'BLINDSANTES' in self.actions: |         if 'BLINDSANTES' in self.actions: | ||||||
|             for act in self.actions['BLINDSANTES']: |             for act in self.actions['BLINDSANTES']: | ||||||
|  |  | ||||||
|  | @ -204,12 +204,17 @@ Tail the in_path file and yield handTexts separated by re_SplitHands""" | ||||||
|     def processHand(self, handText): |     def processHand(self, handText): | ||||||
|         gametype = self.determineGameType(handText) |         gametype = self.determineGameType(handText) | ||||||
|         logging.debug("gametype %s" % gametype) |         logging.debug("gametype %s" % gametype) | ||||||
| 
 |         if gametype is None:  | ||||||
|         # See if gametype is supported. |             l = None | ||||||
|         type = gametype['type'] |             gametype = "unmatched" | ||||||
|         base = gametype['base'] |             # TODO: not ideal, just trying to not error. | ||||||
|         limit = gametype['limitType'] |             # TODO: Need to count failed hands. | ||||||
|         l = [type] + [base] + [limit] |         else: | ||||||
|  |             # See if gametype is supported. | ||||||
|  |             type = gametype['type'] | ||||||
|  |             base = gametype['base'] | ||||||
|  |             limit = gametype['limitType'] | ||||||
|  |             l = [type] + [base] + [limit] | ||||||
|         hand = None |         hand = None | ||||||
|         if l in self.readSupportedGames(): |         if l in self.readSupportedGames(): | ||||||
|             hand = None |             hand = None | ||||||
|  |  | ||||||
|  | @ -196,7 +196,7 @@ class Hud: | ||||||
|             s.window.destroy()     |             s.window.destroy()     | ||||||
|         self.stat_windows = {} |         self.stat_windows = {} | ||||||
| #    also kill any aux windows | #    also kill any aux windows | ||||||
|         map(lambda m: m.destroy(), self.aux_windows) |         [aux.destroy() for aux in self.aux_windows] | ||||||
|         self.aux_windows = [] |         self.aux_windows = [] | ||||||
| 
 | 
 | ||||||
|     def reposition_windows(self, *args): |     def reposition_windows(self, *args): | ||||||
|  | @ -217,8 +217,7 @@ class Hud: | ||||||
|             new_layout[self.stat_windows[sw].adj - 1] = new_loc |             new_layout[self.stat_windows[sw].adj - 1] = new_loc | ||||||
|         self.config.edit_layout(self.table.site, self.max, locations = new_layout) |         self.config.edit_layout(self.table.site, self.max, locations = new_layout) | ||||||
| #    ask each aux to save its layout back to the config object | #    ask each aux to save its layout back to the config object | ||||||
|         for aux in self.aux_windows: |         [aux.save_layout() for aux in self.aux_windows] | ||||||
|             aux.save_layout() |  | ||||||
| #    save the config object back to the file | #    save the config object back to the file | ||||||
|         print "saving new xml file" |         print "saving new xml file" | ||||||
|         self.config.save() |         self.config.save() | ||||||
|  | @ -351,6 +350,8 @@ class Hud: | ||||||
|                 style = win32gui.GetWindowLong(self.table.number, win32con.GWL_EXSTYLE) |                 style = win32gui.GetWindowLong(self.table.number, win32con.GWL_EXSTYLE) | ||||||
|                 style |= win32con.WS_CLIPCHILDREN |                 style |= win32con.WS_CLIPCHILDREN | ||||||
|                 win32gui.SetWindowLong(self.table.number, win32con.GWL_EXSTYLE, style) |                 win32gui.SetWindowLong(self.table.number, win32con.GWL_EXSTYLE, style) | ||||||
|  |                 break | ||||||
|  |              | ||||||
|         window.set_title(real_name) |         window.set_title(real_name) | ||||||
| 
 | 
 | ||||||
| class Stat_Window: | class Stat_Window: | ||||||
|  | @ -575,6 +576,7 @@ class Popup_window: | ||||||
|                 style = win32gui.GetWindowLong(self.table.number, win32con.GWL_EXSTYLE) |                 style = win32gui.GetWindowLong(self.table.number, win32con.GWL_EXSTYLE) | ||||||
|                 style |= win32con.WS_CLIPCHILDREN |                 style |= win32con.WS_CLIPCHILDREN | ||||||
|                 win32gui.SetWindowLong(self.table.number, win32con.GWL_EXSTYLE, style) |                 win32gui.SetWindowLong(self.table.number, win32con.GWL_EXSTYLE, style) | ||||||
|  |                 break | ||||||
|                  |                  | ||||||
|         window.set_title(real_name) |         window.set_title(real_name) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -81,23 +81,13 @@ class fpdb: | ||||||
|     def display_tab(self, new_tab_name): |     def display_tab(self, new_tab_name): | ||||||
|         """displays the indicated tab""" |         """displays the indicated tab""" | ||||||
|         #print "start of display_tab, len(self.tab_names):",len(self.tab_names) |         #print "start of display_tab, len(self.tab_names):",len(self.tab_names) | ||||||
|         tab_no=-1 |         tab_no = -1 | ||||||
|         #if len(self.tab_names)>1: |         for i, name in enumerate(self.tab_names): | ||||||
|         for i in range(len(self.tab_names)): |             if name == new_tab_name: | ||||||
|             #print "display_tab, new_tab_name:",new_tab_name,"  self.tab_names[i]:", self.tab_names[i] |                 tab_no = i | ||||||
|             if (new_tab_name==self.tab_names[i]): |                 break | ||||||
|                 tab_no=i |  | ||||||
|                 #self.tab_buttons[i].set_active(False) |  | ||||||
|         #else: |  | ||||||
|         #    tab_no=0 |  | ||||||
| 
 | 
 | ||||||
|         #current_tab_no=-1 |         if tab_no == -1: | ||||||
|         for i in range(len(self.tab_names)): |  | ||||||
|             if self.current_tab==self.tabs[i]: |  | ||||||
|                 #self.tab_buttons[i].set_active(False) |  | ||||||
|                 pass |  | ||||||
| 
 |  | ||||||
|         if tab_no==-1: |  | ||||||
|             raise fpdb_simple.FpdbError("invalid tab_no") |             raise fpdb_simple.FpdbError("invalid tab_no") | ||||||
|         else: |         else: | ||||||
|             self.main_vbox.remove(self.current_tab) |             self.main_vbox.remove(self.current_tab) | ||||||
|  | @ -199,12 +189,13 @@ class fpdb: | ||||||
|     def dia_recreate_tables(self, widget, data): |     def dia_recreate_tables(self, widget, data): | ||||||
|         """Dialogue that asks user to confirm that he wants to delete and recreate the tables""" |         """Dialogue that asks user to confirm that he wants to delete and recreate the tables""" | ||||||
|         self.obtain_global_lock() |         self.obtain_global_lock() | ||||||
|         dia_confirm=gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, |          | ||||||
|  |         dia_confirm = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, | ||||||
|                 buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm deleting and recreating tables") |                 buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm deleting and recreating tables") | ||||||
|         diastring=("Please confirm that you want to (re-)create the tables. If there already are tables in the database "+self.db.database+" on "+self.db.host+" they will be deleted.") |         diastring = "Please confirm that you want to (re-)create the tables. If there already are tables in the database "+self.db.database+" on "+self.db.host+" they will be deleted." | ||||||
|         dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted |         dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted | ||||||
| 
 | 
 | ||||||
|         response=dia_confirm.run() |         response = dia_confirm.run() | ||||||
|         dia_confirm.destroy() |         dia_confirm.destroy() | ||||||
|         if response == gtk.RESPONSE_YES: |         if response == gtk.RESPONSE_YES: | ||||||
|             self.db.recreate_tables() |             self.db.recreate_tables() | ||||||
|  |  | ||||||
|  | @ -23,12 +23,12 @@ import FpdbSQLQueries | ||||||
| class fpdb_db: | class fpdb_db: | ||||||
|     def __init__(self): |     def __init__(self): | ||||||
|         """Simple constructor, doesnt really do anything""" |         """Simple constructor, doesnt really do anything""" | ||||||
|         self.db=None |         self.db             = None | ||||||
|         self.cursor=None |         self.cursor         = None | ||||||
|         self.sql = {} |         self.sql            = {} | ||||||
|         self.MYSQL_INNODB=2 |         self.MYSQL_INNODB   = 2 | ||||||
|         self.PGSQL=3 |         self.PGSQL          = 3 | ||||||
|         self.SQLITE=4 |         self.SQLITE         = 4 | ||||||
|     #end def __init__ |     #end def __init__ | ||||||
| 
 | 
 | ||||||
|     def do_connect(self, config=None): |     def do_connect(self, config=None): | ||||||
|  | @ -37,10 +37,7 @@ class fpdb_db: | ||||||
|             raise FpdbError('Configuration not defined') |             raise FpdbError('Configuration not defined') | ||||||
| 
 | 
 | ||||||
|         self.settings = {} |         self.settings = {} | ||||||
|         if (os.sep=="/"): |         self.settings['os'] = "linuxmac" if os.name != "nt" else "windows" | ||||||
|             self.settings['os']="linuxmac" |  | ||||||
|         else: |  | ||||||
|             self.settings['os']="windows" |  | ||||||
| 
 | 
 | ||||||
|         self.settings.update(config.get_db_parameters()) |         self.settings.update(config.get_db_parameters()) | ||||||
|         self.connect(self.settings['db-backend'], |         self.connect(self.settings['db-backend'], | ||||||
|  |  | ||||||
|  | @ -51,22 +51,22 @@ class Importer: | ||||||
| 
 | 
 | ||||||
|     def __init__(self, caller, settings, config): |     def __init__(self, caller, settings, config): | ||||||
|         """Constructor""" |         """Constructor""" | ||||||
|         self.settings=settings |         self.settings   = settings | ||||||
|         self.caller=caller |         self.caller     = caller | ||||||
|         self.config = config |         self.config     = config | ||||||
|         self.fdb = None |         self.fdb        = None | ||||||
|         self.cursor = None |         self.cursor     = None | ||||||
|         self.filelist = {} |         self.filelist   = {} | ||||||
|         self.dirlist = {} |         self.dirlist    = {} | ||||||
|         self.addToDirList = {} |         self.addToDirList = {} | ||||||
|         self.removeFromFileList = {} # to remove deleted files |         self.removeFromFileList = {} # to remove deleted files | ||||||
|         self.monitor = False |         self.monitor    = False | ||||||
|         self.updated = {}       #Time last import was run {file:mtime} |         self.updated    = {}       #Time last import was run {file:mtime} | ||||||
|         self.lines = None |         self.lines      = None | ||||||
|         self.faobs = None       #File as one big string |         self.faobs      = None       #File as one big string | ||||||
|         self.pos_in_file = {} # dict to remember how far we have read in the file |         self.pos_in_file = {} # dict to remember how far we have read in the file | ||||||
|         #Set defaults |         #Set defaults | ||||||
|         self.callHud = self.config.get_import_parameters().get("callFpdbHud") |         self.callHud    = self.config.get_import_parameters().get("callFpdbHud") | ||||||
|         if 'minPrint' not in self.settings: |         if 'minPrint' not in self.settings: | ||||||
|             #TODO: Is this value in the xml file? |             #TODO: Is this value in the xml file? | ||||||
|             self.settings['minPrint'] = 30 |             self.settings['minPrint'] = 30 | ||||||
|  | @ -188,24 +188,26 @@ class Importer: | ||||||
|             self.addImportDirectory(self.dirlist[site][0], False, site, self.dirlist[site][1]) |             self.addImportDirectory(self.dirlist[site][0], False, site, self.dirlist[site][1]) | ||||||
| 
 | 
 | ||||||
|         for file in self.filelist: |         for file in self.filelist: | ||||||
|             stat_info = os.stat(file) |             if os.path.exists(file):             | ||||||
|             try:  |                 stat_info = os.stat(file) | ||||||
|                 lastupdate = self.updated[file] |                 try:  | ||||||
|                 if stat_info.st_mtime > lastupdate: |                     lastupdate = self.updated[file] | ||||||
|                     self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) |                     if stat_info.st_mtime > lastupdate: | ||||||
|  |                         self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) | ||||||
|  |                         self.updated[file] = time() | ||||||
|  |                 except: | ||||||
|                     self.updated[file] = time() |                     self.updated[file] = time() | ||||||
|             except: |                     # If modified in the last minute run an immediate import. | ||||||
|                 self.updated[file] = time() |                     # This codepath only runs first time the file is found. | ||||||
|                 # If modified in the last minute run an immediate import. |                     if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60: | ||||||
|                 # This codepath only runs first time the file is found. |                         # TODO attach a HHC thread to the file | ||||||
|                 if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60: |                         # TODO import the output of the HHC thread  -- this needs to wait for the HHC to block? | ||||||
|                     # TODO attach a HHC thread to the file |                         self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) | ||||||
|                     # TODO import the output of the HHC thread  -- this needs to wait for the HHC to block? |  | ||||||
|                     self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) |  | ||||||
|                 # TODO we also test if directory, why? |                 # TODO we also test if directory, why? | ||||||
|                 #if os.path.isdir(file): |                 #if os.path.isdir(file): | ||||||
|                     #self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) |                     #self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) | ||||||
|                      |             else: | ||||||
|  |                 removeFromFileList[file] = True | ||||||
|         self.addToDirList = filter(lambda x: self.addImportDirectory(x, True, self.addToDirList[x][0], self.addToDirList[x][1]), self.addToDirList)                        |         self.addToDirList = filter(lambda x: self.addImportDirectory(x, True, self.addToDirList[x][0], self.addToDirList[x][1]), self.addToDirList)                        | ||||||
|              |              | ||||||
|         for file in self.removeFromFileList: |         for file in self.removeFromFileList: | ||||||
|  | @ -251,7 +253,6 @@ class Importer: | ||||||
|                 print "Unknown filter filter_name:'%s' in filter:'%s'" %(filter_name, filter) |                 print "Unknown filter filter_name:'%s' in filter:'%s'" %(filter_name, filter) | ||||||
|                 return |                 return | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|         #This will barf if conv.getStatus != True |         #This will barf if conv.getStatus != True | ||||||
|         return (stored, duplicates, partial, errors, ttime) |         return (stored, duplicates, partial, errors, ttime) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -22,47 +22,46 @@ import fpdb_save_to_db | ||||||
| 
 | 
 | ||||||
| #parses a holdem hand | #parses a holdem hand | ||||||
| def mainParser(backend, db, cursor, site, category, hand, config): | def mainParser(backend, db, cursor, site, category, hand, config): | ||||||
|     category=fpdb_simple.recogniseCategory(hand[0]) |     category = fpdb_simple.recogniseCategory(hand[0]) | ||||||
|     if (category=="holdem" or category=="omahahi" or category=="omahahilo"): |      | ||||||
|         base="hold" |     base = "hold" if category == "holdem" or category == "omahahi" or category == "omahahilo" else "stud" | ||||||
|     else: |      | ||||||
|         base="stud" |  | ||||||
|     #part 0: create the empty arrays |     #part 0: create the empty arrays | ||||||
|     lineTypes=[] #char, valid values: header, name, cards, action, win, rake, ignore |     lineTypes   = [] #char, valid values: header, name, cards, action, win, rake, ignore | ||||||
|     lineStreets=[] #char, valid values: (predeal, preflop, flop, turn, river) |     lineStreets = [] #char, valid values: (predeal, preflop, flop, turn, river) | ||||||
| 
 | 
 | ||||||
|     cardValues, cardSuits, boardValues, boardSuits, antes, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo, seatLines, winnings, rakes=[],[],[],[],[],[],[],[],[],[],[],[],[] |     cardValues, cardSuits, boardValues, boardSuits, antes, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo, seatLines, winnings, rakes=[],[],[],[],[],[],[],[],[],[],[],[],[] | ||||||
| 
 | 
 | ||||||
|     #part 1: read hand no and check for duplicate |     #part 1: read hand no and check for duplicate | ||||||
|     siteHandNo=fpdb_simple.parseSiteHandNo(hand[0]) |     siteHandNo      = fpdb_simple.parseSiteHandNo(hand[0]) | ||||||
|     handStartTime=fpdb_simple.parseHandStartTime(hand[0], site) |     handStartTime   = fpdb_simple.parseHandStartTime(hand[0], site) | ||||||
|     siteID=fpdb_simple.recogniseSiteID(cursor, site) |     siteID          = fpdb_simple.recogniseSiteID(cursor, site) | ||||||
|     #print "parse logic, siteID:",siteID,"site:",site |     #print "parse logic, siteID:",siteID,"site:",site | ||||||
|      |      | ||||||
|     isTourney=fpdb_simple.isTourney(hand[0]) |     isTourney       = fpdb_simple.isTourney(hand[0]) | ||||||
|     smallBlindLine=0 |     smallBlindLine  = 0 | ||||||
|     for i in range(len(hand)): |     for i, line in enumerate(hand): | ||||||
|         if 'posts small blind' in hand[i] or 'posts the small blind' in hand[i]: |         if 'posts small blind' in line or 'posts the small blind' in line: | ||||||
|             if hand[i][-2:] == "$0": |             if line[-2:] == "$0": continue | ||||||
|                 continue |             smallBlindLine = i | ||||||
|             smallBlindLine=i |  | ||||||
|             #print "found small blind line:",smallBlindLine |  | ||||||
|             break |             break | ||||||
|     #print "small blind line:",smallBlindLine |     #print "small blind line:",smallBlindLine | ||||||
|     gametypeID=fpdb_simple.recogniseGametypeID(backend, db, cursor, hand[0], hand[smallBlindLine], siteID, category, isTourney) |      | ||||||
|  |     gametypeID = fpdb_simple.recogniseGametypeID(backend, db, cursor, hand[0], hand[smallBlindLine], siteID, category, isTourney) | ||||||
|     if isTourney: |     if isTourney: | ||||||
|         if site!="ps": |         if site != "ps": | ||||||
|             raise fpdb_simple.FpdbError("tourneys are only supported on PS right now") |             raise fpdb_simple.FpdbError("tourneys are only supported on PS right now") | ||||||
|         siteTourneyNo=fpdb_simple.parseTourneyNo(hand[0]) |         siteTourneyNo   = fpdb_simple.parseTourneyNo(hand[0]) | ||||||
|         buyin=fpdb_simple.parseBuyin(hand[0]) |         buyin           = fpdb_simple.parseBuyin(hand[0]) | ||||||
|         fee=fpdb_simple.parseFee(hand[0]) |         fee             = fpdb_simple.parseFee(hand[0]) | ||||||
|         entries=-1 #todo: parse this |         entries         = -1 #todo: parse this | ||||||
|         prizepool=-1 #todo: parse this |         prizepool       = -1 #todo: parse this | ||||||
|         knockout=0 |         knockout        = 0 | ||||||
|         tourneyStartTime=handStartTime #todo: read tourney start time |         tourneyStartTime= handStartTime #todo: read tourney start time | ||||||
|         rebuyOrAddon=fpdb_simple.isRebuyOrAddon(hand[0]) |         rebuyOrAddon    = fpdb_simple.isRebuyOrAddon(hand[0]) | ||||||
| 
 | 
 | ||||||
|         tourneyTypeId=fpdb_simple.recogniseTourneyTypeId(cursor, siteID, buyin, fee, knockout, rebuyOrAddon)         |         tourneyTypeId   = fpdb_simple.recogniseTourneyTypeId(cursor, siteID, buyin, fee, knockout, rebuyOrAddon) | ||||||
|  |          | ||||||
|     fpdb_simple.isAlreadyInDB(cursor, gametypeID, siteHandNo) |     fpdb_simple.isAlreadyInDB(cursor, gametypeID, siteHandNo) | ||||||
|      |      | ||||||
|     #part 2: classify lines by type (e.g. cards, action, win, sectionchange) and street |     #part 2: classify lines by type (e.g. cards, action, win, sectionchange) and street | ||||||
|  | @ -70,85 +69,82 @@ def mainParser(backend, db, cursor, site, category, hand, config): | ||||||
|          |          | ||||||
|     #part 3: read basic player info     |     #part 3: read basic player info     | ||||||
|     #3a read player names, startcashes |     #3a read player names, startcashes | ||||||
|     for i in range (len(hand)): #todo: use maxseats+1 here. |     for i, line in enumerate(hand): | ||||||
|         if (lineTypes[i]=="name"): |         if lineTypes[i] == "name": | ||||||
|             seatLines.append(hand[i]) |             seatLines.append(line) | ||||||
|     names=fpdb_simple.parseNames(seatLines) |              | ||||||
|     playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID) |     names       = fpdb_simple.parseNames(seatLines) | ||||||
|     tmp=fpdb_simple.parseCashesAndSeatNos(seatLines, site) |     playerIDs   = fpdb_simple.recognisePlayerIDs(cursor, names, siteID) | ||||||
|     startCashes=tmp['startCashes'] |     tmp         = fpdb_simple.parseCashesAndSeatNos(seatLines, site) | ||||||
|     seatNos=tmp['seatNos'] |     startCashes = tmp['startCashes'] | ||||||
|  |     seatNos     = tmp['seatNos'] | ||||||
|      |      | ||||||
|     fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo) |     fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo) | ||||||
|      |      | ||||||
|     #3b read positions |     #3b read positions | ||||||
|     if base=="hold": |     if base == "hold": | ||||||
|         positions = fpdb_simple.parsePositions (hand, names) |         positions = fpdb_simple.parsePositions(hand, names) | ||||||
|      |      | ||||||
|     #part 4: take appropriate action for each line based on linetype |     #part 4: take appropriate action for each line based on linetype | ||||||
|     for i in range(len(hand)): |     for i, line in enumerate(hand): | ||||||
|         if (lineTypes[i]=="cards"): |         if lineTypes[i] == "cards": | ||||||
|             fpdb_simple.parseCardLine (site, category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits) |             fpdb_simple.parseCardLine(site, category, lineStreets[i], line, names, cardValues, cardSuits, boardValues, boardSuits) | ||||||
|             #if category=="studhilo": |             #if category=="studhilo": | ||||||
|             #    print "hand[i]:", hand[i] |             #    print "hand[i]:", hand[i] | ||||||
|             #    print "cardValues:", cardValues |             #    print "cardValues:", cardValues | ||||||
|             #    print "cardSuits:", cardSuits |             #    print "cardSuits:", cardSuits | ||||||
|         elif (lineTypes[i]=="action"): |         elif lineTypes[i] == "action": | ||||||
|             fpdb_simple.parseActionLine (site, base, isTourney, hand[i], lineStreets[i], playerIDs, names, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo) |             fpdb_simple.parseActionLine(site, base, isTourney, line, lineStreets[i], playerIDs, names, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo) | ||||||
|         elif (lineTypes[i]=="win"): |         elif lineTypes[i] == "win": | ||||||
|             fpdb_simple.parseWinLine (hand[i], site, names, winnings, isTourney) |             fpdb_simple.parseWinLine(line, site, names, winnings, isTourney) | ||||||
|         elif (lineTypes[i]=="rake"): |         elif lineTypes[i] == "rake": | ||||||
|             if isTourney: |             totalRake = 0 if isTourney else fpdb_simple.parseRake(line) | ||||||
|                 totalRake=0 |  | ||||||
|             else: |  | ||||||
|                 totalRake=fpdb_simple.parseRake(hand[i]) |  | ||||||
|             fpdb_simple.splitRake(winnings, rakes, totalRake) |             fpdb_simple.splitRake(winnings, rakes, totalRake) | ||||||
|         elif (lineTypes[i]=="header" or lineTypes[i]=="rake" or lineTypes[i]=="name" or lineTypes[i]=="ignore"): |         elif lineTypes[i]=="header" or lineTypes[i]=="rake" or lineTypes[i]=="name" or lineTypes[i]=="ignore": | ||||||
|             pass |             pass | ||||||
|         elif (lineTypes[i]=="ante"): |         elif lineTypes[i]=="ante": | ||||||
|             fpdb_simple.parseAnteLine(hand[i], site, isTourney, names, antes) |             fpdb_simple.parseAnteLine(line, site, isTourney, names, antes) | ||||||
|         elif (lineTypes[i]=="table"): |         elif lineTypes[i]=="table": | ||||||
|             tableResult=fpdb_simple.parseTableLine(site, base, hand[i]) |             tableResult=fpdb_simple.parseTableLine(site, base, line) | ||||||
|         else: |         else: | ||||||
|             raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i]) |             raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i]) | ||||||
|     if site=="ftp": |          | ||||||
|         tableResult=fpdb_simple.parseTableLine(site, base, hand[0]) |     if site == "ftp": | ||||||
|     maxSeats=tableResult['maxSeats'] |         tableResult = fpdb_simple.parseTableLine(site, base, hand[0]) | ||||||
|     tableName=tableResult['tableName'] |          | ||||||
|  |     maxSeats    = tableResult['maxSeats'] | ||||||
|  |     tableName   = tableResult['tableName'] | ||||||
|     #print "before part5, antes:", antes |     #print "before part5, antes:", antes | ||||||
|      |      | ||||||
|     #part 5: final preparations, then call fpdb_save_to_db.* with |     #part 5: final preparations, then call fpdb_save_to_db.* with | ||||||
|     #         the arrays as they are - that file will fill them. |     #         the arrays as they are - that file will fill them. | ||||||
|     fpdb_simple.convertCardValues(cardValues) |     fpdb_simple.convertCardValues(cardValues) | ||||||
|     if base=="hold": |     if base == "hold": | ||||||
|         fpdb_simple.convertCardValuesBoard(boardValues) |         fpdb_simple.convertCardValuesBoard(boardValues) | ||||||
|         fpdb_simple.convertBlindBet(actionTypes, actionAmounts) |         fpdb_simple.convertBlindBet(actionTypes, actionAmounts) | ||||||
|         fpdb_simple.checkPositions(positions) |         fpdb_simple.checkPositions(positions) | ||||||
|          |          | ||||||
|     cursor.execute("SELECT limitType FROM Gametypes WHERE id=%s",(gametypeID, )) |     cursor.execute("SELECT limitType FROM Gametypes WHERE id=%s",(gametypeID, )) | ||||||
|     limit_type=cursor.fetchone()[0] |     limit_type = cursor.fetchone()[0] | ||||||
|     fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts) |     fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts) | ||||||
|      |      | ||||||
|     totalWinnings=0 |     totalWinnings = sum(winnings) | ||||||
|     for i in range(len(winnings)): |  | ||||||
|         totalWinnings+=winnings[i] |  | ||||||
|      |      | ||||||
|     if base=="hold": |     # if hold'em, use positions and not antes, if stud do not use positions, use antes | ||||||
|         hudImportData=fpdb_simple.generateHudCacheData(playerIDs, base, category, actionTypes |     if base == "hold": | ||||||
|  |         hudImportData = fpdb_simple.generateHudCacheData(playerIDs, base, category, actionTypes | ||||||
|                                      , allIns, actionTypeByNo, winnings, totalWinnings, positions |                                      , allIns, actionTypeByNo, winnings, totalWinnings, positions | ||||||
|                                      , actionTypes, actionAmounts, None) |                                      , actionTypes, actionAmounts, None) | ||||||
|     else: |     else: | ||||||
|         hudImportData=fpdb_simple.generateHudCacheData(playerIDs, base, category, actionTypes |         hudImportData = fpdb_simple.generateHudCacheData(playerIDs, base, category, actionTypes | ||||||
|                                      , allIns, actionTypeByNo, winnings, totalWinnings, None |                                      , allIns, actionTypeByNo, winnings, totalWinnings, None | ||||||
|                                      , actionTypes, actionAmounts, antes) |                                      , actionTypes, actionAmounts, antes) | ||||||
|      |      | ||||||
|     if isTourney: |     if isTourney: | ||||||
|         ranks=[] |         ranks = map(lambda x: 0, names) # create an array of 0's equal to the length of names | ||||||
|         for i in range (len(names)): |         payin_amounts = fpdb_simple.calcPayin(len(names), buyin, fee) | ||||||
|             ranks.append(0) |  | ||||||
|         payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee) |  | ||||||
|          |          | ||||||
|         if base=="hold": |         if base == "hold": | ||||||
|             result = fpdb_save_to_db.tourney_holdem_omaha( |             result = fpdb_save_to_db.tourney_holdem_omaha( | ||||||
|                                        config, backend, db, cursor, base, category, siteTourneyNo, buyin |                                        config, backend, db, cursor, base, category, siteTourneyNo, buyin | ||||||
|                                      , fee, knockout, entries, prizepool, tourneyStartTime |                                      , fee, knockout, entries, prizepool, tourneyStartTime | ||||||
|  | @ -157,7 +153,7 @@ def mainParser(backend, db, cursor, site, category, hand, config): | ||||||
|                                      , positions, cardValues, cardSuits, boardValues, boardSuits |                                      , positions, cardValues, cardSuits, boardValues, boardSuits | ||||||
|                                      , winnings, rakes, actionTypes, allIns, actionAmounts |                                      , winnings, rakes, actionTypes, allIns, actionAmounts | ||||||
|                                      , actionNos, hudImportData, maxSeats, tableName, seatNos) |                                      , actionNos, hudImportData, maxSeats, tableName, seatNos) | ||||||
|         elif base=="stud": |         elif base == "stud": | ||||||
|             result = fpdb_save_to_db.tourney_stud( |             result = fpdb_save_to_db.tourney_stud( | ||||||
|                                        config, backend, db, cursor, base, category, siteTourneyNo |                                        config, backend, db, cursor, base, category, siteTourneyNo | ||||||
|                                      , buyin, fee, knockout, entries, prizepool, tourneyStartTime |                                      , buyin, fee, knockout, entries, prizepool, tourneyStartTime | ||||||
|  | @ -167,9 +163,9 @@ def mainParser(backend, db, cursor, site, category, hand, config): | ||||||
|                                      , allIns, actionAmounts, actionNos, hudImportData, maxSeats |                                      , allIns, actionAmounts, actionNos, hudImportData, maxSeats | ||||||
|                                      , tableName, seatNos) |                                      , tableName, seatNos) | ||||||
|         else: |         else: | ||||||
|             raise fpdb_simple.FpdbError ("unrecognised category") |             raise fpdb_simple.FpdbError("unrecognised category") # it's impossible to get here, but w/e | ||||||
|     else: |     else: | ||||||
|         if base=="hold": |         if base == "hold": | ||||||
|             result = fpdb_save_to_db.ring_holdem_omaha( |             result = fpdb_save_to_db.ring_holdem_omaha( | ||||||
|                                        config, backend, db, cursor, base, category, siteHandNo |                                        config, backend, db, cursor, base, category, siteHandNo | ||||||
|                                      , gametypeID, handStartTime, names, playerIDs |                                      , gametypeID, handStartTime, names, playerIDs | ||||||
|  | @ -177,7 +173,7 @@ def mainParser(backend, db, cursor, site, category, hand, config): | ||||||
|                                      , boardValues, boardSuits, winnings, rakes |                                      , boardValues, boardSuits, winnings, rakes | ||||||
|                                      , actionTypes, allIns, actionAmounts, actionNos |                                      , actionTypes, allIns, actionAmounts, actionNos | ||||||
|                                      , hudImportData, maxSeats, tableName, seatNos) |                                      , hudImportData, maxSeats, tableName, seatNos) | ||||||
|         elif base=="stud": |         elif base == "stud": | ||||||
|             result = fpdb_save_to_db.ring_stud( |             result = fpdb_save_to_db.ring_stud( | ||||||
|                                        config, backend, db, cursor, base, category, siteHandNo, gametypeID |                                        config, backend, db, cursor, base, category, siteHandNo, gametypeID | ||||||
|                                      , handStartTime, names, playerIDs, startCashes, antes |                                      , handStartTime, names, playerIDs, startCashes, antes | ||||||
|  | @ -185,7 +181,7 @@ def mainParser(backend, db, cursor, site, category, hand, config): | ||||||
|                                      , actionAmounts, actionNos, hudImportData, maxSeats, tableName |                                      , actionAmounts, actionNos, hudImportData, maxSeats, tableName | ||||||
|                                      , seatNos) |                                      , seatNos) | ||||||
|         else: |         else: | ||||||
|             raise fpdb_simple.FpdbError ("unrecognised category") |             raise fpdb_simple.FpdbError ("unrecognised category") # also impossible to get here | ||||||
|     db.commit() |     db.commit() | ||||||
|     return result |     return result | ||||||
| #end def mainParser | #end def mainParser | ||||||
|  |  | ||||||
|  | @ -22,13 +22,13 @@ from time import time | ||||||
| 
 | 
 | ||||||
| import fpdb_simple | import fpdb_simple | ||||||
| 
 | 
 | ||||||
| MYSQL_INNODB=2 | MYSQL_INNODB    = 2 | ||||||
| PGSQL=3 | PGSQL           = 3 | ||||||
| SQLITE=4 | SQLITE          = 4 | ||||||
| 
 | 
 | ||||||
| fastStoreHudCache=True   # set this to True to test the new storeHudCache routine | fastStoreHudCache = True   # set this to True to test the new storeHudCache routine | ||||||
| 
 | 
 | ||||||
| saveActions=False    # set this to False to avoid storing action data | saveActions = False    # set this to False to avoid storing action data | ||||||
|                     # Pros: speeds up imports |                     # Pros: speeds up imports | ||||||
|                     # Cons: no action data is saved, so you need to keep the hand histories |                     # Cons: no action data is saved, so you need to keep the hand histories | ||||||
|                     #       variance not available on stats page |                     #       variance not available on stats page | ||||||
|  | @ -40,16 +40,17 @@ def ring_stud(config, backend, db, cursor, base, category, site_hand_no, gametyp | ||||||
|              ,seatNos): |              ,seatNos): | ||||||
| 
 | 
 | ||||||
|     import_options = config.get_import_parameters() |     import_options = config.get_import_parameters() | ||||||
|     saveActions = import_options['saveActions'] |      | ||||||
|     fastStoreHudCache = import_options['fastStoreHudCache'] |     saveActions = True if import_options['saveActions'] == 'True' else False | ||||||
|  |     fastStoreHudCache = True if import_options['fastStoreHudCache'] == 'True' else False | ||||||
| 
 | 
 | ||||||
|     fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits) |     fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits) | ||||||
|      |      | ||||||
|     hands_id=fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id |     hands_id = fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id | ||||||
|                                    ,hand_start_time, names, tableName, maxSeats) |                                    ,hand_start_time, names, tableName, maxSeats) | ||||||
|      |      | ||||||
|     #print "before calling store_hands_players_stud, antes:", antes |     #print "before calling store_hands_players_stud, antes:", antes | ||||||
|     hands_players_ids=fpdb_simple.store_hands_players_stud(backend, db, cursor, hands_id, player_ids |     hands_players_ids = fpdb_simple.store_hands_players_stud(backend, db, cursor, hands_id, player_ids | ||||||
|                                                           ,start_cashes, antes, card_values |                                                           ,start_cashes, antes, card_values | ||||||
|                                                           ,card_suits, winnings, rakes, seatNos) |                                                           ,card_suits, winnings, rakes, seatNos) | ||||||
|      |      | ||||||
|  | @ -68,8 +69,8 @@ def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no, | ||||||
|     """stores a holdem/omaha hand into the database""" |     """stores a holdem/omaha hand into the database""" | ||||||
| 
 | 
 | ||||||
|     import_options = config.get_import_parameters() |     import_options = config.get_import_parameters() | ||||||
|     saveActions = import_options['saveActions'] |     saveActions = True if import_options['saveActions'] == 'True' else False | ||||||
|     fastStoreHudCache = import_options['fastStoreHudCache'] |     fastStoreHudCache = True if import_options['fastStoreHudCache'] == 'True' else False | ||||||
| 
 | 
 | ||||||
|     t0 = time() |     t0 = time() | ||||||
|     fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits) |     fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits) | ||||||
|  | @ -77,10 +78,10 @@ def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no, | ||||||
|     fpdb_simple.fill_board_cards(board_values, board_suits) |     fpdb_simple.fill_board_cards(board_values, board_suits) | ||||||
|     t2 = time() |     t2 = time() | ||||||
| 
 | 
 | ||||||
|     hands_id=fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id |     hands_id = fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id | ||||||
|                                    ,hand_start_time, names, tableName, maxSeats) |                                    ,hand_start_time, names, tableName, maxSeats) | ||||||
|     t3 = time() |     t3 = time() | ||||||
|     hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha( |     hands_players_ids = fpdb_simple.store_hands_players_holdem_omaha( | ||||||
|                                backend, db, cursor, category, hands_id, player_ids, start_cashes |                                backend, db, cursor, category, hands_id, player_ids, start_cashes | ||||||
|                              , positions, card_values, card_suits, winnings, rakes, seatNos) |                              , positions, card_values, card_suits, winnings, rakes, seatNos) | ||||||
|     t4 = time()             |     t4 = time()             | ||||||
|  | @ -109,19 +110,19 @@ def tourney_holdem_omaha(config, backend, db, cursor, base, category, siteTourne | ||||||
|     """stores a tourney holdem/omaha hand into the database""" |     """stores a tourney holdem/omaha hand into the database""" | ||||||
| 
 | 
 | ||||||
|     import_options = config.get_import_parameters() |     import_options = config.get_import_parameters() | ||||||
|     saveActions = import_options['saveActions'] |     saveActions = True if import_options['saveActions'] == 'True' else False | ||||||
|     fastStoreHudCache = import_options['fastStoreHudCache'] |     fastStoreHudCache = True if import_options['fastStoreHudCache'] == 'True' else False | ||||||
| 
 | 
 | ||||||
|     fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits) |     fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits) | ||||||
|     fpdb_simple.fill_board_cards(board_values, board_suits) |     fpdb_simple.fill_board_cards(board_values, board_suits) | ||||||
|      |      | ||||||
|     tourney_id=fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourney_start) |     tourney_id = fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourney_start) | ||||||
|     tourneys_players_ids=fpdb_simple.store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks, winnings) |     tourneys_players_ids = fpdb_simple.store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks, winnings) | ||||||
|      |      | ||||||
|     hands_id=fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id |     hands_id = fpdb_simple.storeHands(backend, db, cursor, site_hand_no, gametype_id | ||||||
|                                    ,hand_start_time, names, tableName, maxSeats) |                                    ,hand_start_time, names, tableName, maxSeats) | ||||||
|      |      | ||||||
|     hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha_tourney( |     hands_players_ids = fpdb_simple.store_hands_players_holdem_omaha_tourney( | ||||||
|                       backend, db, cursor, category, hands_id, player_ids, start_cashes, positions |                       backend, db, cursor, category, hands_id, player_ids, start_cashes, positions | ||||||
|                     , card_values, card_suits, winnings, rakes, seatNos, tourneys_players_ids) |                     , card_values, card_suits, winnings, rakes, seatNos, tourneys_players_ids) | ||||||
|      |      | ||||||
|  | @ -146,18 +147,18 @@ def tourney_stud(config, backend, db, cursor, base, category, siteTourneyNo, buy | ||||||
| #stores a tourney stud/razz hand into the database | #stores a tourney stud/razz hand into the database | ||||||
| 
 | 
 | ||||||
|     import_options = config.get_import_parameters() |     import_options = config.get_import_parameters() | ||||||
|     saveActions = import_options['saveActions'] |     saveActions = True if import_options['saveActions'] == 'True' else False | ||||||
|     fastStoreHudCache = import_options['fastStoreHudCache'] |     fastStoreHudCache = True if import_options['fastStoreHudCache'] == 'True' else False | ||||||
|      |      | ||||||
|     fpdb_simple.fillCardArrays(len(names), base, category, cardValues, cardSuits) |     fpdb_simple.fillCardArrays(len(names), base, category, cardValues, cardSuits) | ||||||
|      |      | ||||||
|     tourney_id=fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourneyStartTime) |     tourney_id = fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourneyStartTime) | ||||||
|      |      | ||||||
|     tourneys_players_ids=fpdb_simple.store_tourneys_players(cursor, tourney_id, playerIds, payin_amounts, ranks, winnings) |     tourneys_players_ids = fpdb_simple.store_tourneys_players(cursor, tourney_id, playerIds, payin_amounts, ranks, winnings) | ||||||
|      |      | ||||||
|     hands_id=fpdb_simple.storeHands(backend, db, cursor, siteHandNo, gametypeId, handStartTime, names, tableName, maxSeats) |     hands_id = fpdb_simple.storeHands(backend, db, cursor, siteHandNo, gametypeId, handStartTime, names, tableName, maxSeats) | ||||||
|      |      | ||||||
|     hands_players_ids=fpdb_simple.store_hands_players_stud_tourney(backend, db, cursor, hands_id |     hands_players_ids = fpdb_simple.store_hands_players_stud_tourney(backend, db, cursor, hands_id | ||||||
|                                              , playerIds, startCashes, antes, cardValues, cardSuits |                                              , playerIds, startCashes, antes, cardValues, cardSuits | ||||||
|                                              , winnings, rakes, seatNos, tourneys_players_ids) |                                              , winnings, rakes, seatNos, tourneys_players_ids) | ||||||
|      |      | ||||||
|  |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user