Restore the old --tweak-book functionality to calibre-debug as --explode-book

This commit is contained in:
Kovid Goyal 2013-11-11 15:32:57 +05:30
parent d84fd0b5a4
commit 4f4dd87b2a

View File

@ -62,6 +62,12 @@ Everything after the -- is passed to the script.
help='Inspect the MOBI file(s) at the specified path(s)') help='Inspect the MOBI file(s) at the specified path(s)')
parser.add_option('-t', '--tweak-book', action='store_true', parser.add_option('-t', '--tweak-book', action='store_true',
help='Launch the calibre Tweak Book tool in debug mode.') help='Launch the calibre Tweak Book tool in debug mode.')
parser.add_option('-x', '--explode-book', default=None,
help='Explode the book (exports the book as a collection of HTML '
'files and metadata, which you can edit using standard HTML '
'editing tools, and then rebuilds the file from the edited HTML. '
'Makes no additional changes to the HTML, unlike a full calibre '
'conversion).')
parser.add_option('-s', '--shutdown-running-calibre', default=False, parser.add_option('-s', '--shutdown-running-calibre', default=False,
action='store_true', action='store_true',
help=_('Cause a running calibre instance, if any, to be' help=_('Cause a running calibre instance, if any, to be'
@ -247,6 +253,9 @@ def main(args=sys.argv):
elif opts.tweak_book: elif opts.tweak_book:
from calibre.gui2.tweak_book.main import main from calibre.gui2.tweak_book.main import main
main(['ebook-tweak'] + args[1:]) main(['ebook-tweak'] + args[1:])
elif opts.explode_book:
from calibre.ebooks.tweak import tweak
tweak(opts.explode_book)
elif opts.test_build: elif opts.test_build:
from calibre.test_build import test from calibre.test_build import test
test() test()