mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/file-setup.git
synced 2024-12-25 10:54:18 +00:00
Add filename argument
This commit is contained in:
parent
df309cf27a
commit
4a2266f390
17
setup_files
17
setup_files
@ -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)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user