mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-06-30 22:19:57 +02:00
ocrd_cli: but do check for existing output files
Co-authored-by: Robert Sachunsky <38561704+bertsky@users.noreply.github.com>
This commit is contained in:
parent
4162836612
commit
f6a2c94520
1 changed files with 5 additions and 1 deletions
|
@ -59,8 +59,12 @@ class OcrdDinglehopperEvaluate(Processor):
|
|||
[".html", "text/html"],
|
||||
[".json", "application/json"],
|
||||
]:
|
||||
output_file_id = file_id + report_suffix
|
||||
output_file = next(self.workspace.mets.find_files(ID=output_file_id), None)
|
||||
if output_file and config.OCRD_EXISTING_OUTPUT != 'OVERWRITE':
|
||||
raise FileExistsError(f"A file with ID=={output_file_id} already exists {output_file} and neither force nor ignore are set")
|
||||
self.workspace.add_file(
|
||||
file_id=file_id + report_suffix,
|
||||
file_id=output_file_id,
|
||||
file_grp=self.output_file_grp,
|
||||
page_id=page_id,
|
||||
mimetype=mimetype,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue