- subprocess.check_call(['ebook-convert', epub_file.name, output_file,
- '--no-inline-toc'], **kwargs)
- os.unlink(epub_file.name)
+
+ output_file = NamedTemporaryFile(prefix='librarian', suffix='.mobi', delete=False)
+ output_file.close()
+ subprocess.check_call(['ebook-convert', epub.get_filename(), output_file.name,
+ '--no-inline-toc', '--cover=%s' % cover_file.name], **kwargs)
+ os.unlink(cover_file.name)
+ return OutputFile.from_filename(output_file.name)
\ No newline at end of file