fpdb_import runUpdated() will now remove files that were found to be newly missing on it's most recent pass from it's list of files to check

This commit is contained in:
eblade 2009-02-25 22:44:03 -05:00
parent 7ebf27c07e
commit 560cb1a543

View File

@ -61,6 +61,7 @@ class Importer:
self.filelist = {} self.filelist = {}
self.dirlist = {} self.dirlist = {}
self.addToDirList = {} self.addToDirList = {}
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
@ -188,7 +189,11 @@ class Importer:
for dir in self.addToDirList: for dir in self.addToDirList:
self.addImportDirectory(dir, True, self.addToDirList[dir][0], self.addToDirList[dir][1]) self.addImportDirectory(dir, True, self.addToDirList[dir][0], self.addToDirList[dir][1])
for file in self.removeFromFileList:
del self.filelist[file]
self.addToDirList = {} self.addToDirList = {}
self.removeFromFileList = {}
# This is now an internal function that should not be called directly. # This is now an internal function that should not be called directly.
def import_file_dict(self, file, site, filter): def import_file_dict(self, file, site, filter):
@ -235,10 +240,15 @@ class Importer:
if (file=="stdin"): if (file=="stdin"):
inputFile=sys.stdin inputFile=sys.stdin
else: else:
if os.path.exists(file):
inputFile = open(file, "rU")
else:
self.removeFromFileList['file'] = True
return
try: try:
inputFile=open(file, "rU")
loc = self.pos_in_file[file] loc = self.pos_in_file[file]
except: pass except:
pass
# Read input file into class and close file # Read input file into class and close file
inputFile.seek(loc) inputFile.seek(loc)