mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add warning when MOBI output plugin detects and removes an HTML cover
This commit is contained in:
parent
e7b39e9158
commit
6958a6f907
@ -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)
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user