Merge branch 'gh/pdf-metadata-fix' of https://github.com/aroig/calibre

This commit is contained in:
Kovid Goyal 2016-09-08 20:37:15 +05:30
commit 8f655cd610

View File

@ -95,7 +95,7 @@ def get_metadata(stream, cover=True):
raw = f.read().strip()
if raw:
prints(raw)
if not info:
if info is None:
raise ValueError('Could not read info dict from PDF')
covpath = os.path.join(pdfpath, 'cover.jpg')
cdata = None
@ -103,7 +103,7 @@ def get_metadata(stream, cover=True):
with open(covpath, 'rb') as f:
cdata = f.read()
title = info.get('Title', None)
title = info.get('Title', None) or _('Unknown')
au = info.get('Author', None)
if au is None:
au = [_('Unknown')]