Merge branch 'master' of git://git.assembla.com/free_poker_tools

This commit is contained in:
Worros 2008-10-11 01:46:34 +08:00
commit 60b97582e5

View File

@ -48,6 +48,7 @@ class Importer:
self.options = None self.options = None
self.callHud = False self.callHud = False
self.lines = None self.lines = None
self.pos_in_file = {} # dict to remember how far we have read in the file
def dbConnect(self, options, settings): def dbConnect(self, options, settings):
#connect to DB #connect to DB
@ -74,15 +75,20 @@ class Importer:
self.options=options self.options=options
starttime = time() starttime = time()
last_read_hand=0 last_read_hand=0
loc = 0
if (options.inputFile=="stdin"): if (options.inputFile=="stdin"):
inputFile=sys.stdin inputFile=sys.stdin
else: else:
inputFile=open(options.inputFile, "rU") inputFile=open(options.inputFile, "rU")
try: loc = self.pos_in_file[options.inputFile]
except: pass
self.dbConnect(options,settings) self.dbConnect(options,settings)
# Read input file into class and close file # Read input file into class and close file
inputFile.seek(loc)
self.lines=fpdb_simple.removeTrailingEOL(inputFile.readlines()) self.lines=fpdb_simple.removeTrailingEOL(inputFile.readlines())
self.pos_in_file[options.inputFile] = inputFile.tell()
inputFile.close() inputFile.close()
firstline = self.lines[0] firstline = self.lines[0]