Skip to content

Commit

Permalink
ocrd workspace find --undo-download: more intuitive output
Browse files Browse the repository at this point in the history
  • Loading branch information
kba committed Sep 11, 2023
1 parent a583a50 commit 0f26809
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ocrd/ocrd/cli/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,16 +444,17 @@ def workspace_find(ctx, file_grp, mimetype, page_id, file_id, output_field, down
mimetype=mimetype,
page_id=page_id,
):
ret_entry = [f.ID if field == 'pageId' else str(getattr(f, field)) or '' for field in output_field]
if download and not f.local_filename:
workspace.download_file(f)
modified_mets = True
if wait:
time.sleep(wait)
if undo_download and f.local_filename:
ret_entry = [f'Removed local_filename {f.local_filename}']
f.local_filename = None
modified_mets = True
ret.append([f.ID if field == 'pageId' else str(getattr(f, field)) or ''
for field in output_field])
ret.append(ret_entry)
if modified_mets:
workspace.save_mets()
if 'pageId' in output_field:
Expand Down

0 comments on commit 0f26809

Please sign in to comment.