winziprint: allow files to escape padding

This commit is contained in:
2023-10-23 22:29:06 +02:00
parent 92c7a99cf8
commit 10dbae8663

View File

@ -27,7 +27,7 @@ def convert(input_files: list[str],
tmp_file_names = []
page_nums = []
html_files = [file for file in input_files if not file.endswith('.pdf')]
html_files = [file.lstrip('!') for file in input_files if not file.endswith('.pdf')]
steps = len(html_files) + len(html_files) // BATCH_SIZE + 1
try:
@ -57,7 +57,7 @@ def convert(input_files: list[str],
for n, file_name in enumerate(input_files):
p0 = len(merger.pages)
if file_name.endswith('.pdf'):
merger.append(file_name)
merger.append(file_name.lstrip('!'))
else:
batch_page_nums = tmp_page_nums[i // BATCH_SIZE * BATCH_SIZE:(i // BATCH_SIZE + 1) * BATCH_SIZE]
page_start = sum(batch_page_nums[:i % BATCH_SIZE])
@ -65,7 +65,7 @@ def convert(input_files: list[str],
i += 1
p1 = len(merger.pages)
page_nums.append(p1 - p0)
if padding and len(merger.pages) % 2 != 0:
if padding and file_name[0] != '!' and len(merger.pages) % 2 != 0:
merger.add_blank_page()
merger.write(output_files)
merger.close()