mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Default implementation of comic2mobi as wrapper for comic2epub
This commit is contained in:
parent
7717679733
commit
310cd9e96e
44
src/calibre/ebooks/mobi/from_comic.py
Normal file
44
src/calibre/ebooks/mobi/from_comic.py
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
'''
|
||||
import sys, os
|
||||
from calibre.ebooks.lrf.comic.convert_from import do_convert, option_parser, \
|
||||
ProgressBar, terminal_controller
|
||||
from calibre.ebooks.mobi.from_any import config, any2mobi
|
||||
from calibre.ptempfile import PersistentTemporaryFile
|
||||
|
||||
|
||||
def convert(path_to_file, opts, notification=lambda m, p: p):
|
||||
pt = PersistentTemporaryFile('_comic2mobi.epub')
|
||||
pt.close()
|
||||
orig_output = opts.output
|
||||
opts.output = pt.name
|
||||
do_convert(path_to_file, opts, notification=notification, output_format='epub')
|
||||
opts = config('').parse()
|
||||
if orig_output is None:
|
||||
orig_output = os.path.splitext(path_to_file)[0]+'.mobi'
|
||||
opts.output = orig_output
|
||||
any2mobi(opts, pt.name)
|
||||
|
||||
def main(args=sys.argv):
|
||||
parser = option_parser()
|
||||
opts, args = parser.parse_args(args)
|
||||
if len(args) < 2:
|
||||
parser.print_help()
|
||||
print '\nYou must specify a file to convert'
|
||||
return 1
|
||||
|
||||
pb = ProgressBar(terminal_controller, _('Rendering comic pages...'),
|
||||
no_progress_bar=opts.no_progress_bar or getattr(opts, 'no_process', False))
|
||||
notification = pb.update
|
||||
|
||||
source = os.path.abspath(args[1])
|
||||
convert(source, opts, notification=notification)
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
@ -63,6 +63,7 @@ entry_points = {
|
||||
'oeb2lit = calibre.ebooks.lit.writer:main',
|
||||
'comic2lrf = calibre.ebooks.lrf.comic.convert_from:main',
|
||||
'comic2epub = calibre.ebooks.epub.from_comic:main',
|
||||
'comic2mobi = calibre.ebooks.mobi.from_comic:main',
|
||||
'comic2pdf = calibre.ebooks.pdf.from_comic:main',
|
||||
'calibre-debug = calibre.debug:main',
|
||||
'calibredb = calibre.library.cli:main',
|
||||
@ -239,6 +240,7 @@ def setup_completion(fatal_errors):
|
||||
f.write(opts_and_exts('lit2oeb', lit2oeb, ['lit']))
|
||||
f.write(opts_and_exts('comic2lrf', comicop, ['cbz', 'cbr']))
|
||||
f.write(opts_and_exts('comic2epub', comic2epub, ['cbz', 'cbr']))
|
||||
f.write(opts_and_exts('comic2mobi', comic2epub, ['cbz', 'cbr']))
|
||||
f.write(opts_and_exts('comic2pdf', comic2epub, ['cbz', 'cbr']))
|
||||
f.write(opts_and_words('feeds2disk', feeds2disk, feed_titles))
|
||||
f.write(opts_and_words('feeds2lrf', feeds2lrf, feed_titles))
|
||||
|
Loading…
x
Reference in New Issue
Block a user