Add warning when MOBI output plugin detects and removes an HTML cover

This commit is contained in:
Kovid Goyal 2011-03-28 11:20:12 -06:00
parent e7b39e9158
commit 6958a6f907
2 changed files with 10 additions and 2 deletions

View File

@ -102,6 +102,7 @@ class MobiMLizer(object):
def __call__(self, oeb, context):
oeb.logger.info('Converting XHTML to Mobipocket markup...')
self.oeb = oeb
self.log = self.oeb.logger
self.opts = context
self.profile = profile = context.dest
self.fnums = fnums = dict((v, k) for k, v in profile.fnums.items())
@ -118,6 +119,10 @@ class MobiMLizer(object):
del oeb.guide['cover']
item = oeb.manifest.hrefs[href]
if item.spine_position is not None:
self.log.warn('Found an HTML cover,', item.href, 'removing it.',
'If you find some content missing from the output MOBI, it '
'is because you misidentified the HTML cover in the input '
'document')
oeb.spine.remove(item)
if item.media_type in OEB_DOCS:
self.oeb.manifest.remove(item)

View File

@ -31,8 +31,11 @@ class cmd_commit(_cmd_commit):
summary = ''
raw = urllib.urlopen('https://bugs.launchpad.net/calibre/+bug/' +
bug).read()
h1 = html.fromstring(raw).xpath('//h1[@id="edit-title"]')[0]
summary = html.tostring(h1, method='text', encoding=unicode).strip()
try:
h1 = html.fromstring(raw).xpath('//h1[@id="edit-title"]')[0]
summary = html.tostring(h1, method='text', encoding=unicode).strip()
except:
summary = 'Private bug'
print 'Working on bug:', summary
if summary:
msg = msg.replace('#%s'%bug, '#%s (%s)'%(bug, summary))