mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Misc. fixes
This commit is contained in:
parent
dfe2522b05
commit
7475c676e4
@ -7,6 +7,15 @@ __docformat__ = 'restructuredtext en'
|
||||
Command line interface to conversion sub-system
|
||||
'''
|
||||
|
||||
import sys, os
|
||||
from optparse import OptionGroup, Option
|
||||
|
||||
from calibre.utils.config import OptionParser
|
||||
from calibre.utils.logging import Log
|
||||
from calibre.constants import preferred_encoding
|
||||
from calibre.customize.conversion import OptionRecommendation
|
||||
|
||||
|
||||
USAGE = '%prog ' + _('''\
|
||||
input_file output_file [options]
|
||||
|
||||
@ -33,14 +42,6 @@ option.
|
||||
For full documentation of the conversion system see
|
||||
''') + 'http://calibre.kovidgoyal.net/user_manual/conversion.html'
|
||||
|
||||
import sys, os
|
||||
from optparse import OptionGroup, Option
|
||||
|
||||
from calibre.utils.config import OptionParser
|
||||
from calibre.utils.logging import Log
|
||||
from calibre.constants import preferred_encoding
|
||||
from calibre.customize.conversion import OptionRecommendation
|
||||
|
||||
def print_help(parser, log):
|
||||
help = parser.format_help().encode(preferred_encoding, 'replace')
|
||||
log(help)
|
||||
|
@ -357,7 +357,10 @@ class MobiWriter(object):
|
||||
self._map_image_names()
|
||||
self._generate_text()
|
||||
if INDEXING and not self.opts.no_mobi_index:
|
||||
try:
|
||||
self._generate_index()
|
||||
except:
|
||||
self._oeb.log.exception('Failed to generate index')
|
||||
self._generate_images()
|
||||
|
||||
def _map_image_names(self):
|
||||
@ -507,6 +510,9 @@ class MobiWriter(object):
|
||||
ctoc = self._generate_ctoc()
|
||||
indxt, indxt_count, indices, last_name = \
|
||||
self._generate_indxt(ctoc)
|
||||
if last_name is None:
|
||||
self._oeb.log.warn('Input document has no TOC. No idex generated.')
|
||||
return
|
||||
|
||||
indx1 = StringIO()
|
||||
indx1.write('INDX'+pack('>I', 0xc0)) # header length
|
||||
|
Loading…
x
Reference in New Issue
Block a user