Replayer: Add start of relacement importhand function
This commit is contained in:
parent
06978fb77b
commit
20c5ecee82
|
@ -249,31 +249,52 @@ class GuiReplayer:
|
||||||
be replaced by a function to select a hand from the db in the not so distant future.
|
be replaced by a function to select a hand from the db in the not so distant future.
|
||||||
This code has been shamelessly stolen from Carl
|
This code has been shamelessly stolen from Carl
|
||||||
"""
|
"""
|
||||||
settings = {}
|
if True:
|
||||||
settings.update(self.conf.get_db_parameters())
|
settings = {}
|
||||||
settings.update(self.conf.get_import_parameters())
|
settings.update(self.conf.get_db_parameters())
|
||||||
settings.update(self.conf.get_default_paths())
|
settings.update(self.conf.get_import_parameters())
|
||||||
|
settings.update(self.conf.get_default_paths())
|
||||||
|
|
||||||
importer = fpdb_import.Importer(False, settings, self.conf, None)
|
importer = fpdb_import.Importer(False, settings, self.conf, None)
|
||||||
importer.setDropIndexes("don't drop")
|
importer.setDropIndexes("don't drop")
|
||||||
importer.setFailOnError(True)
|
importer.setFailOnError(True)
|
||||||
importer.setThreads(-1)
|
importer.setThreads(-1)
|
||||||
importer.setCallHud(False)
|
importer.setCallHud(False)
|
||||||
importer.setFakeCacheHHC(True)
|
importer.setFakeCacheHHC(True)
|
||||||
|
|
||||||
|
print "DEBUG: self.filename: '%s' self.site: '%s'" %(self.filename, self.site)
|
||||||
|
importer.addBulkImportImportFileOrDir(self.filename, site=self.site)
|
||||||
|
(stored, dups, partial, errs, ttime) = importer.runImport()
|
||||||
|
|
||||||
#Get a simple regression file with a few hands of Hold'em
|
hhc = importer.getCachedHHC()
|
||||||
print "DEBUG: self.filename: '%s' self.site: '%s'" %(self.filename, self.site)
|
handlist = hhc.getProcessedHands()
|
||||||
|
|
||||||
importer.addBulkImportImportFileOrDir(self.filename, site=self.site)
|
return handlist[0]
|
||||||
(stored, dups, partial, errs, ttime) = importer.runImport()
|
else:
|
||||||
|
# Fetch hand info
|
||||||
|
# We need at least sitename, gametype, handid
|
||||||
|
# for the Hand.__init__
|
||||||
|
|
||||||
|
####### Shift this section in Database.py for all to use ######
|
||||||
|
handid = 40
|
||||||
|
q = self.sql.query['get_gameinfo_from_hid']
|
||||||
|
q = q.replace('%s', self.sql.query['placeholder'])
|
||||||
|
|
||||||
hhc = importer.getCachedHHC()
|
c = self.db.get_cursor()
|
||||||
handlist = hhc.getProcessedHands()
|
|
||||||
|
|
||||||
return handlist[0]
|
|
||||||
|
|
||||||
|
c.execute(q, (handid,))
|
||||||
|
res = c.fetchone()
|
||||||
|
gametype = {'category':res[1],'base':res[2],'type':res[3],'limitType':res[4],'hilo':res[5],'sb':res[6],'bb':res[7], 'currency':res[10]}
|
||||||
|
#FIXME: smallbet and bigbet are res[8] and res[9] respectively
|
||||||
|
###### End section ########
|
||||||
|
print "DEBUG: gametype: %s" % gametype
|
||||||
|
if gametype['base'] == 'hold':
|
||||||
|
h = HoldemOmahaHand(config = self.conf, hhc = None, sitename=res[0], gametype = gametype, handText=None, builtFrom = "DB", handid=handid)
|
||||||
|
h.select(self.db, handid)
|
||||||
|
elif gametype['base'] == 'stud':
|
||||||
|
print "DEBUG: Create stud hand here"
|
||||||
|
elif gametype['base'] == 'draw':
|
||||||
|
print "DEBUG: Create draw hand here"
|
||||||
|
|
||||||
def temp(self):
|
def temp(self):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user