Database: insert missing HandToWrite.payin_amounts var

EverleafToFpdb: remove DEBUG XXXXXXX line
FulltiltToFpdb: pass on converting tournament hands
Hand: add Hand.fee var that Database is looking for
fpdb_import: clean up file update scan code, queue files that have changed in the last 60 seconds for the next importer pass, instead of locking it up reading them now (not that this does anything since FT no longer updates the mtime until it closes the table, but maybe it works with Stars or others)
This commit is contained in:
eblade 2009-07-30 21:50:08 -04:00
parent c400fd9ba7
commit f5ba0b5b7f
5 changed files with 11 additions and 16 deletions

View File

@ -1620,6 +1620,7 @@ class HandToWrite:
self.maxSeats = None self.maxSeats = None
self.tableName = None self.tableName = None
self.seatNos = None self.seatNos = None
self.payin_amounts = None # tourney import was complaining mightily about this missing
except: except:
print "htw.init error: " + str(sys.exc_info()) print "htw.init error: " + str(sys.exc_info())
raise raise

View File

@ -44,7 +44,7 @@ out_path (default '-' = sys.stdout)
follow : whether to tail -f the input follow : whether to tail -f the input
autostart: whether to run the thread (or you can call start() yourself) autostart: whether to run the thread (or you can call start() yourself)
debugging: if False, pass on partially supported game types. If true, have a go and error...""" debugging: if False, pass on partially supported game types. If true, have a go and error..."""
print "DEBUG: XXXXXXXXXXXXXXX" #print "DEBUG: XXXXXXXXXXXXXXX"
HandHistoryConverter.__init__(self, in_path, out_path, sitename="Everleaf", follow=follow, index=index) HandHistoryConverter.__init__(self, in_path, out_path, sitename="Everleaf", follow=follow, index=index)
logging.info("Initialising Everleaf converter class") logging.info("Initialising Everleaf converter class")
self.filetype = "text" self.filetype = "text"

View File

@ -140,6 +140,7 @@ follow : whether to tail -f the input"""
if mg['TOURNO'] == None: info['type'] = "ring" if mg['TOURNO'] == None: info['type'] = "ring"
else: info['type'] = "tour" else: info['type'] = "tour"
# NB: SB, BB must be interpreted as blinds or bets depending on limit type. # NB: SB, BB must be interpreted as blinds or bets depending on limit type.
if info['type'] == "tour": return None # importer is screwed on tournies, pass on those hands so we don't interrupt other autoimporting
return info return info
#Following function is a hack, we should be dealing with this in readFile (i think correct codepage....) #Following function is a hack, we should be dealing with this in readFile (i think correct codepage....)

View File

@ -56,6 +56,7 @@ class Hand(object):
self.buttonpos = 0 self.buttonpos = 0
self.tourNo = None self.tourNo = None
self.buyin = None self.buyin = None
self.fee = None # the Database code is looking for this one .. ?
self.level = None self.level = None
self.mixed = None self.mixed = None
self.seating = [] self.seating = []

View File

@ -268,23 +268,15 @@ class Importer:
if os.path.exists(file): if os.path.exists(file):
stat_info = os.stat(file) stat_info = os.stat(file)
#rulog.writelines("path exists ") #rulog.writelines("path exists ")
try: if file in self.updated:
lastupdate = self.updated[file] if stat_info.st_size > self.updated[file]:
#rulog.writelines("lastupdate = %d, mtime = %d" % (lastupdate,stat_info.st_mtime))
if stat_info.st_size > lastupdate: #stat_info.st_mtime > lastupdate:
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])
self.updated[file] = stat_info.st_size #time() self.updated[file] = stat_info.st_size
except: else:
self.updated[file] = stat_info.st_size #time()
# If modified in the last minute run an immediate import.
# This codepath only runs first time the file is found.
if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60: if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60:
# TODO attach a HHC thread to the file self.updated[file] = 0
# TODO import the output of the HHC thread -- this needs to wait for the HHC to block? else:
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) self.updated[file] = stat_info.st_size
# TODO we also test if directory, why?
#if os.path.isdir(file):
#self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
else: else:
self.removeFromFileList[file] = True self.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)