Add filename argument

This commit is contained in:
stephan 2020-02-17 14:48:49 +01:00
parent df309cf27a
commit 4a2266f390

View File

@ -18,12 +18,19 @@ import subprocess
def parse_arguments():
parser = argparse.ArgumentParser(description='Merges given input images '
'into one multipage tiff.')
parser.add_argument('-i', dest='input_dir', required=True,
parser.add_argument('-i',
dest='input_dir',
required=True,
type=os.path.abspath)
parser.add_argument('-o', dest='output_dir', required=True,
parser.add_argument('-o',
dest='output_dir',
required=True,
type=os.path.abspath)
parser.add_argument('--zip', action='store_true', default=False,
dest='zip', help='package result files in zip bundles',
parser.add_argument('--zip',
default='combines-pictures',
dest='zip',
type=str,
help='package result files in zip bundles',
required=False)
return parser.parse_args()
@ -40,7 +47,7 @@ def merge_images(input_dir, output_dir, zip):
cmd = 'rm {i}/file_list.txt'.format(i=input_dir)
subprocess.run(cmd, shell=True)
if zip:
cmd = 'cd {o} && zip -m combined.zip combined.tif && cd -'.format(o=output_dir)
cmd = 'cd {o} && zip -m {f}-combined.zip combined.tif && cd -'.format(o=output_dir, f=zip)
subprocess.run(cmd, shell=True)