- # if output to dir, create the file
- if output_dir is not None:
- if make_dir:
- author = unicode(book_info.author)
- output_dir = os.path.join(output_dir, author)
- try:
- os.makedirs(output_dir)
- except OSError:
- pass
- if slug:
- output_file = os.path.join(output_dir, '%s.mobi' % slug)
- else:
- output_file = os.path.join(output_dir, os.path.splitext(os.path.basename(file_path))[0] + '.mobi')
-
- # provide a cover by default
- if not cover:
- cover = WLCover
-
- epub_file = NamedTemporaryFile(suffix='.epub', delete=False)
- if not flags:
- flags = []
- flags = list(flags) + ['without-fonts']
- epub.transform(provider, file_path=file_path, output_file=epub_file, verbose=verbose,
- sample=sample, html_toc=True, cover=cover, flags=flags, style=get_resource('mobi/style.css'))