Fix zip creation

This commit is contained in:
Patrick Jentsch 2020-04-04 15:37:21 +02:00
parent 36a86887b0
commit 364e3d626d

12
ocr
View File

@ -286,11 +286,15 @@ class OCRPipeline(WorkflowRunner):
'''
zip_jobs = []
if self.zip is not None:
# Remove .zip file extension if provided
if self.zip.endswith('.zip'):
self.zip = self.zip[:-4]
self.zip = self.zip if self.zip else 'output'
cmd = 'cd "{}"'.format(self.output_dir)
cmd += ' && '
cmd += 'zip'
cmd += ' -r'
cmd += ' "{}_-_all" .'.format(self.zip)
cmd += ' "{}".zip .'.format(self.zip)
cmd += ' -x "pyflow.data*" "*tmp*"'
cmd += ' -i "*.pdf" "*.txt" "*.xml"'
cmd += ' && '
@ -305,7 +309,7 @@ class OCRPipeline(WorkflowRunner):
cmd += 'zip'
cmd += ' -m'
cmd += ' -r'
cmd += ' "{}_-_pdf" .'.format(self.zip)
cmd += ' "{}".pdf.zip .'.format(self.zip)
cmd += ' -x "pyflow.data*" "*tmp*"'
cmd += ' -i "*.pdf"'
cmd += ' && '
@ -320,7 +324,7 @@ class OCRPipeline(WorkflowRunner):
cmd += 'zip'
cmd += ' -m'
cmd += ' -r'
cmd += ' "{}_-_txt" .'.format(self.zip)
cmd += ' "{}".txt.zip .'.format(self.zip)
cmd += ' -x "pyflow.data*" "*tmp*"'
cmd += ' -i "*.txt"'
cmd += ' && '
@ -335,7 +339,7 @@ class OCRPipeline(WorkflowRunner):
cmd += 'zip'
cmd += ' -m'
cmd += ' -r'
cmd += ' "{}_-_xml" .'.format(self.zip)
cmd += ' "{}".xml.zip .'.format(self.zip)
cmd += ' -x "pyflow.data*" "*tmp*"'
cmd += ' -i "*.xml"'
cmd += ' && '