home · contact · privacy
In Bookmaker, fix page numbering / selection bug.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 24 Sep 2023 00:08:33 +0000 (02:08 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 24 Sep 2023 00:08:33 +0000 (02:08 +0200)
bookmaker.py

index 3a36b962f5014c1b121c93561699d2802f40fdde..b9daa0b332d6b532b277bd39c78a30bed4157615 100755 (executable)
@@ -36,6 +36,7 @@ def parse_page_range(range_string, pages):
     return start_page, end_page
 pages_to_add = []
 opened_files = []
+new_page_num = 0
 for i, input_file in enumerate(args.input_file):
     file = open(input_file, 'rb')
     opened_files += [file]
@@ -44,12 +45,11 @@ for i, input_file in enumerate(args.input_file):
     if args.page_range and len(args.page_range) > i:
         range_string = args.page_range[i]
     start_page, end_page = parse_page_range(range_string, reader.pages)
-    new_page_num = 0
     for old_page_num in range(start_page, end_page):
         new_page_num += 1
-        page = reader.pages[new_page_num]
+        page = reader.pages[old_page_num]
         pages_to_add += [page]
-        print("-i, -p: read in %s page number %d as new page %d" % (input_file, new_page_num+1, new_page_num))
+        print("-i, -p: read in %s page number %d as new page %d" % (input_file, old_page_num+1, new_page_num))
 
 # rotate page canvas
 if args.rotate: