Adapt import functions to use logical paths

This commit is contained in:
D. Berge
2023-08-30 14:56:09 +02:00
parent ccf4bbf547
commit 53f2108e37
6 changed files with 60 additions and 45 deletions

View File

@@ -29,17 +29,19 @@ if __name__ == '__main__':
print(f'Survey: {survey["id"]} ({survey["schema"]})')
db.set_survey(survey["schema"])
for file in survey["preplots"]:
realpath = configuration.translate_path(file["path"])
print(f"Preplot: {file['path']}")
if not db.file_in_db(file["path"]):
age = time.time() - os.path.getmtime(file["path"])
age = time.time() - os.path.getmtime(realpath)
if age < file_min_age:
print("Skipping file because too new", file["path"])
continue
print("Importing")
try:
preplot = preplots.from_file(file)
preplot = preplots.from_file(file, realpath)
except FileNotFoundError:
print(f"File does not exist: {file['path']}", file=sys.stderr)
continue