+
+ # Converters
+
+ def as_html(self, *args, **kwargs):
+ from librarian import html
+ return html.transform(self, *args, **kwargs)
+
+ def as_text(self, *args, **kwargs):
+ from librarian import text
+ return text.transform(self, *args, **kwargs)
+
+ def as_epub(self, *args, **kwargs):
+ from librarian import epub
+ return epub.transform(self, *args, **kwargs)
+
+ def as_pdf(self, *args, **kwargs):
+ from librarian import pdf
+ return pdf.transform(self, *args, **kwargs)
+
+ def as_mobi(self, *args, **kwargs):
+ from librarian import mobi
+ return mobi.transform(self, *args, **kwargs)
+
+ def save_output_file(self, output_file, output_path=None,
+ output_dir_path=None, make_author_dir=False, ext=None):
+ if output_dir_path:
+ save_path = output_dir_path
+ if make_author_dir:
+ save_path = os.path.join(save_path,
+ unicode(self.book_info.author).encode('utf-8'))
+ save_path = os.path.join(save_path,
+ self.book_info.uri.slug)
+ if ext:
+ save_path += '.%s' % ext
+ else:
+ save_path = output_path
+
+ output_file.save_as(save_path)