Change import_file_dict to take new args and fix all callers.

Rename the main parser and make room for site converters.
This commit is contained in:
Worros 2008-11-07 21:18:12 +13:00
parent 6490ee5882
commit 1f3a39142a

View File

@ -125,7 +125,7 @@ class Importer:
#Run full import on filelist
def runImport(self):
for file in self.filelist:
self.import_file_dict(file)
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
#Run import on updated files, then store latest update time.
def runUpdated(self):
@ -140,17 +140,25 @@ class Importer:
try:
lastupdate = self.updated[file]
if stat_info.st_mtime > lastupdate:
self.import_file_dict(file)
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
self.updated[file] = time()
except:
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 (time() - stat_info.st_mtime) < 60:
self.import_file_dict(file)
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
# This is now an internal function that should not be called directly.
def import_file_dict(self, file):
def import_file_dict(self, file, site, filter):
if(filter == "passthrough"):
self.import_fpdb_file(file, site)
else:
#Load filter, and run filtered file though main importer
self.import_fpdb_file(file, site)
def import_fpdb_file(self, file, site):
starttime = time()
last_read_hand=0
loc = 0