- subprocess.check_call(['ebook-convert', epub.get_filename(), output_file.name,
- '--no-inline-toc', '--mobi-file-type=both', '--subset-embedded-fonts', '--mobi-ignore-margins', '--cover=%s' % cover_file.name], **kwargs)
- os.unlink(cover_file.name)
+
+ if use_kindlegen:
+ output_file_basename = os.path.basename(output_file.name)
+ subprocess.check_call(['kindlegen', '-c2', epub.get_filename(),
+ '-o', output_file_basename], **kwargs)
+ else:
+ subprocess.check_call(['ebook-convert', epub.get_filename(),
+ output_file.name, '--no-inline-toc',
+ '--mobi-file-type=both',
+ '--mobi-ignore-margins'], **kwargs)