When merging, start indices at 1 instead of 0.
When going through the resulting merged book in sigil, it's confusing to remember that the index prefix on every file is not actually the number of the book that you're working on, especially if it's a numbered series of books.
This commit is contained in:
parent
261faf66ae
commit
fa65157779
1 changed files with 3 additions and 1 deletions
|
@ -1325,6 +1325,8 @@ def merge(input_filepaths, output_filename, do_headerfile=False):
|
|||
rand_prefix = random_string(3, string.digits)
|
||||
|
||||
for (index, input_filepath) in enumerate(input_filepaths):
|
||||
# Number books from 1 for human sanity.
|
||||
index += 1
|
||||
print(f'Merging {input_filepath.absolute_path}.')
|
||||
prefix = f'{rand_prefix}_{index:>0{index_length}}_{{}}'
|
||||
input_book = Epub.open(input_filepath)
|
||||
|
@ -1364,7 +1366,7 @@ def merge(input_filepaths, output_filename, do_headerfile=False):
|
|||
book.add_file(headerfile_id, headerfile_basename, content)
|
||||
|
||||
for id in manifest_ids:
|
||||
new_id = f'{rand_prefix}_{index:>0{index_length}}_{id}'
|
||||
new_id = prefix.format(id)
|
||||
new_basename = basename_map[id]
|
||||
book.add_file(new_id, new_basename, input_book.read_file(id))
|
||||
|
||||
|
|
Loading…
Reference in a new issue