mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
aa25d2a814
commit
7bbad887d0
@ -26,7 +26,7 @@ class PDFInput(InputFormatPlugin):
|
||||
if self._preprocess_html_for_viewer:
|
||||
from calibre.ebooks.conversion.preprocess import HTMLPreProcessor
|
||||
prepro = HTMLPreProcessor(lambda x:x, False)
|
||||
html = prepro(html)
|
||||
html = prepro(html.decode('utf-8')).encode('utf-8')
|
||||
|
||||
with open('index.html', 'wb') as index:
|
||||
index.write(html)
|
||||
|
@ -36,8 +36,11 @@ def get_metadata(stream):
|
||||
job.update()
|
||||
server.close()
|
||||
if job.result is None:
|
||||
raise ValueError('Failed to read metadata: PoDoFo crashed')
|
||||
raise ValueError('Failed to read metadata: ' + job.details)
|
||||
title, authors, creator = job.result
|
||||
if title == '_':
|
||||
title = getattr(stream, 'name', _('Unknown'))
|
||||
title = os.path.splitext(title)[0]
|
||||
|
||||
mi = MetaInformation(title, authors)
|
||||
if creator:
|
||||
@ -50,8 +53,7 @@ def get_metadata_(path):
|
||||
p.open(path)
|
||||
title = p.title
|
||||
if not title:
|
||||
title = getattr(stream, 'name', _('Unknown'))
|
||||
title = os.path.splitext(os.path.basename(title))[0]
|
||||
title = '_'
|
||||
author = p.author
|
||||
authors = string_to_authors(author) if author else [_('Unknown')]
|
||||
creator = p.creator
|
||||
|
Loading…
x
Reference in New Issue
Block a user