Fix calculation of merge index, after globbing.

This commit is contained in:
Ethan Dalool 2019-09-08 21:25:10 -07:00
parent 5416276b00
commit 7cbdff827e

View file

@ -1297,11 +1297,10 @@ def holdit_argparse(args):
def merge(input_filepaths, output_filename, do_headerfile=False): def merge(input_filepaths, output_filename, do_headerfile=False):
book = Epub.new() book = Epub.new()
input_filepaths = [pathclass.Path(p) for pattern in input_filepaths for p in glob.glob(pattern)]
index_length = len(str(len(input_filepaths))) index_length = len(str(len(input_filepaths)))
rand_prefix = random_string(3, string.digits) rand_prefix = random_string(3, string.digits)
input_filepaths = [pathclass.Path(p) for pattern in input_filepaths for p in glob.glob(pattern)]
for (index, input_filepath) in enumerate(input_filepaths): for (index, input_filepath) in enumerate(input_filepaths):
print(f'Merging {input_filepath.absolute_path}.') print(f'Merging {input_filepath.absolute_path}.')
prefix = f'{rand_prefix}_{index:>0{index_length}}_{{}}' prefix = f'{rand_prefix}_{index:>0{index_length}}_{{}}'