mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/file-setup.git
synced 2024-12-26 19:34:19 +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():
|
def parse_arguments():
|
||||||
parser = argparse.ArgumentParser(description='Merges given input images '
|
parser = argparse.ArgumentParser(description='Merges given input images '
|
||||||
'into one multipage tiff.')
|
'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)
|
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)
|
type=os.path.abspath)
|
||||||
parser.add_argument('--zip', action='store_true', default=False,
|
parser.add_argument('--zip',
|
||||||
dest='zip', help='package result files in zip bundles',
|
default='combines-pictures',
|
||||||
|
dest='zip',
|
||||||
|
type=str,
|
||||||
|
help='package result files in zip bundles',
|
||||||
required=False)
|
required=False)
|
||||||
return parser.parse_args()
|
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)
|
cmd = 'rm {i}/file_list.txt'.format(i=input_dir)
|
||||||
subprocess.run(cmd, shell=True)
|
subprocess.run(cmd, shell=True)
|
||||||
if zip:
|
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)
|
subprocess.run(cmd, shell=True)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user