This commit is contained in:
Kovid Goyal 2009-05-24 22:11:40 -07:00
parent aa25d2a814
commit 7bbad887d0
2 changed files with 6 additions and 4 deletions

View File

@ -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)

View File

@ -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