def append_to_main_djvu(self, djvu_page_file, djvu_main_file): """Attach the page djvu to the main file.""" pages2djvu.append_page(djvu_page_file, djvu_main_file) self.djvu_full_filesize = os.path.getsize(djvu_main_file) self.status = 'Page appended to DJVU. (Page size %s, total size: %s)' % ( utils.get_size_text(self.djvu_page_filesize), utils.get_size_text(self.djvu_full_filesize))
def convert_to_djvu(self, djvu_page_file): """Convert the page to a DJVU file and append it to the main file""" pages2djvu.convert_file(self.filepath, djvu_page_file, bitonal=self.opts['djvu_bitonal'], quality=self.opts['djvu_quality']) if os.path.isfile(djvu_page_file): self.djvu_page_filesize = os.path.getsize(djvu_page_file) self.status = 'Page converted to DJVU. (%s)' % utils.get_size_text(self.djvu_page_filesize,'kB') return True else: print ('\t(ERR) Page not converted to DjVu. Perhaps djvulibre is broken?') self.status = 'Page NOT converted to DJVU. An error occured in the conversion' return False