Patch for djvubind

General discussion about software packages and releases, new software you've found, and threads by programmers and script writers.

Moderator: peterZ

Post Reply
Mangan
Posts: 17
Joined: 19 Jan 2012, 14:33
E-book readers owned: Sony Xperia Arc
Number of books owned: 1000

Patch for djvubind

Post by Mangan »

Sometims the book pages doesn't start on 1, but on 7 for instance. Up unitl that, they are in roman numerals or not at all.

I added a small patch with option to specify start for page number, "--title-start-number'. It was for me, but anyone can use
it. I will send to the maintainer also. :-)

Code: Select all

*** djvubind.orig       2014-02-05 19:02:51.911384792 +0100
--- djvubind    2014-02-06 11:00:13.188333698 +0100
***************
*** 193,198 ****
--- 193,199 ----
                       'csepdjvu_options':'',
                       'minidjvu_options':'--match -pages-per-dict 100',
                       'title_start':False,
+                      'title_start_number':1,
                       'title_exclude':{},
                       'title_uppercase':False,
                       'win_path':'C:\\Program Files\\DjVuZone\\DjVuLibre\\'}
***************
*** 242,247 ****
--- 243,250 ----
              self.opts['cuneiform_options'] = opts.cuneiform_options
          if opts.title_start:
              self.opts['title_start'] = opts.title_start
+         if opts.title_start_number:
+             self.opts['title_start_number'] = opts.title_start_number
          for special in opts.title_exclude:
              if ':' in special:
                  special = special.split(':')
***************
*** 321,327 ****
                          no_ocr=False, ocr_engine=None, tesseract_options=None, cuneiform_options=None,
                          cover_front='cover_front.jpg', cover_back='cover_back.jpg',
                          metadata='metadata', bookmarks='bookmarks',
!                         title_start=False, title_exclude=[], title_uppercase=False)
      parser.add_option("--cover-front", dest="cover_front", help="Specifies an alternate front cover image.  By default, '%default' is used if present.")
      parser.add_option("--cover-back", dest="cover_back", help="Specifies an alternate back cover image.  By default, '%default' is used if present.")
      parser.add_option("--metadata", dest="metadata", help="Specifies an alternate metadata file.  By default, '%default' is used if present.")
--- 324,330 ----
                          no_ocr=False, ocr_engine=None, tesseract_options=None, cuneiform_options=None,
                          cover_front='cover_front.jpg', cover_back='cover_back.jpg',
                          metadata='metadata', bookmarks='bookmarks',
!                         title_start=False, title_start_number=1, title_exclude=[], title_uppercase=False)
      parser.add_option("--cover-front", dest="cover_front", help="Specifies an alternate front cover image.  By default, '%default' is used if present.")
      parser.add_option("--cover-back", dest="cover_back", help="Specifies an alternate back cover image.  By default, '%default' is used if present.")
      parser.add_option("--metadata", dest="metadata", help="Specifies an alternate metadata file.  By default, '%default' is used if present.")
***************
*** 331,336 ****
--- 334,340 ----
      parser.add_option("--tesseract-options", dest="tesseract_options", help="Additional command line options to pass to tesseract.")
      parser.add_option("--cuneiform-options", dest="cuneiform_options", help="Additional command line options to pass to cuneiform.")
      parser.add_option("--title-start", dest="title_start", help="The image filename that is page 1.  Pages before this will titled with roman numerals.")
+     parser.add_option("--title-start-number", dest="title_start_number", help="The number for the first page in arabic numerals.")
      parser.add_option("--title-exclude", action="append", dest="title_exclude", help="An image that should be excluded from page numbering.  An alternate title can be provided after a colon (e.g. page_01.tif:cover).")
      parser.add_option("--title-uppercase", action="store_true", dest="title_uppercase", help="Use uppercase roman numerals instead of lowercase.")
      parser.add_option("-q", "--quiet", action="store_true", dest="quiet")
***************
*** 395,401 ****
              if proj.opts['title_start'] is not False:
                  filename = os.path.basename(filename)
                  if proj.opts['title_start'] == filename:
!                     counter = djvubind.utils.counter(start=1)
                  if filename in proj.opts['title_exclude']:
                      proj.book.pages[-1].title = proj.opts['title_exclude'][filename]
                  else:
--- 399,405 ----
              if proj.opts['title_start'] is not False:
                  filename = os.path.basename(filename)
                  if proj.opts['title_start'] == filename:
!                     counter = djvubind.utils.counter(start=int(proj.opts['title_start_number']))
                  if filename in proj.opts['title_exclude']:
                      proj.book.pages[-1].title = proj.opts['title_exclude'][filename]
                  else:
Post Reply