Store last parsed file and resume from there.
This commit is contained in:
parent
8f35dec4c3
commit
e6031486ec
@ -19,6 +19,11 @@ MOS_LOG_PATH = c.get("MOS", "XML_LOG_PATH")
|
|||||||
# TODO: Store and read from database or ini!
|
# TODO: Store and read from database or ini!
|
||||||
LAST_PARSED_FILE = "MOSMessage-20170221-120000.xml"
|
LAST_PARSED_FILE = "MOSMessage-20170221-120000.xml"
|
||||||
|
|
||||||
|
if os.path.isfile(".last_file"):
|
||||||
|
with open(".last_file", "r") as f:
|
||||||
|
LAST_PARSED_FILE = f.readline().strip()
|
||||||
|
f.close()
|
||||||
|
|
||||||
# Scan available MOSMessage logs and collect those we still need to scan
|
# Scan available MOSMessage logs and collect those we still need to scan
|
||||||
files_to_parse = []
|
files_to_parse = []
|
||||||
for file in os.listdir(MOS_LOG_PATH):
|
for file in os.listdir(MOS_LOG_PATH):
|
||||||
@ -62,3 +67,6 @@ for file in files_to_parse:
|
|||||||
db.finish()
|
db.finish()
|
||||||
print("")
|
print("")
|
||||||
print("Last file: {}".format(last_file))
|
print("Last file: {}".format(last_file))
|
||||||
|
with open(".last_file", "w") as f:
|
||||||
|
f.write(last_file)
|
||||||
|
f.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user