3
__copyright__ = '2009, Kovid Goyal kovid@kovidgoyal.net'
4
__docformat__ = 'restructuredtext en'
9
from calibre.ebooks.lrf.comic.convert_from import do_convert, option_parser, \
10
ProgressBar, terminal_controller
11
from calibre.ebooks.mobi.from_any import config, any2mobi
12
from calibre.ptempfile import PersistentTemporaryFile
15
def convert(path_to_file, opts, notification=lambda m, p: p):
16
pt = PersistentTemporaryFile('_comic2mobi.epub')
18
orig_output = opts.output
20
do_convert(path_to_file, opts, notification=notification, output_format='epub')
21
opts = config('').parse()
22
if orig_output is None:
23
orig_output = os.path.splitext(path_to_file)[0]+'.mobi'
24
opts.output = orig_output
25
any2mobi(opts, pt.name)
27
def main(args=sys.argv):
28
parser = option_parser()
29
opts, args = parser.parse_args(args)
32
print '\nYou must specify a file to convert'
35
pb = ProgressBar(terminal_controller, _('Rendering comic pages...'),
36
no_progress_bar=opts.no_progress_bar or getattr(opts, 'no_process', False))
37
notification = pb.update
39
source = os.path.abspath(args[1])
40
convert(source, opts, notification=notification)
43
if __name__ == '__main__':
b'\\ No newline at end of file'