1
# -*- coding: utf-8 -*-
4
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
5
__docformat__ = 'restructuredtext en'
9
from calibre.customize.conversion import OutputFormatPlugin
10
from calibre.ebooks.rb.writer import RBWriter
12
class RBOutput(OutputFormatPlugin):
15
author = 'John Schember'
18
def convert(self, oeb_book, output_path, input_plugin, opts, log):
20
if not hasattr(output_path, 'write'):
22
if not os.path.exists(os.path.dirname(output_path)) and os.path.dirname(output_path) != '':
23
os.makedirs(os.path.dirname(output_path))
24
out_stream = open(output_path, 'wb')
26
out_stream = output_path
28
writer = RBWriter(opts, log)
33
writer.write_content(oeb_book, out_stream, oeb_book.metadata)