Skip to content

Commit

Permalink
alto
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvaler1 committed Jul 18, 2023
1 parent 030939c commit d81b426
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions download_documents_alto_by_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ def main():
job_indication_file = os.path.join(args.base, folder, 'job-status-export-alto.json')
if os.path.exists(job_indication_file):
try:

job_id = get_job_id(job_indication_file)
logging.info(f"Download job {job_id} output")

if os.path.exists(f'{folder}\\export_document_{job_id}.zip'):
skipped += 1
Expand All @@ -195,21 +197,28 @@ def main():

try:

logging.info(f"Unzipping")
unzip_folder(zip_path, os.path.join(args.base, folder), job_id)
logging.info(f"Building folders")
new_root_path = build_files_and_folders_hirrechy(zip_path, args)
logging.info(f"edit and rename")
edit_and_rename_alto_files(new_root_path)

except Exception as e:
write_error(e)
errors_edit_mets += 1
logging.exception(f"Exception: {e}")

else :
print (f'job {resp["jobId"]} is {resp["state"]}. Please try again later')
errors_download += 1
except Exception as e:
write_error(e)
errors_download += 1
logging.exception(f"Exception: {e}")
break

logging.info(f'Done. downloaded: {downloaded}. skipped: {skipped}. errors download: {errors_download}. errors edit: {errors_edit_mets}')
print(f'Done. downloaded: {downloaded}. skipped: {skipped}. errors download: {errors_download}. errors edit: {errors_edit_mets}')


Expand Down

0 comments on commit d81b426

Please sign in to comment.