mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-22 07:53:21 +02:00
Add warning when MOBI output plugin detects and removes an HTML cover
This commit is contained in:
parent
e7b39e9158
commit
6958a6f907
2 changed files with 10 additions and 2 deletions
|
|
@ -102,6 +102,7 @@ def __init__(self, ignore_tables=False):
|
|||
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 @@ def remove_html_cover(self):
|
|||
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 @@ def expand_bug(self, msg):
|
|||
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…
Reference in a new issue