Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed May 31, 2012
1 parent e2148e8 commit 4c24997
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/calibre/ebooks/metadata/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from calibre.constants import iswindows
from calibre.ptempfile import TemporaryDirectory
from calibre.ebooks.metadata import MetaInformation, string_to_authors
from calibre.utils.ipc.simple_worker import fork_job
from calibre.utils.ipc.simple_worker import fork_job, WorkerError

#_isbn_pat = re.compile(r'ISBN[: ]*([-0-9Xx]+)')

Expand Down Expand Up @@ -63,8 +63,12 @@ def get_metadata(stream, cover=True):
stream.seek(0)
with open(os.path.join(pdfpath, 'src.pdf'), 'wb') as f:
shutil.copyfileobj(stream, f)
res = fork_job('calibre.ebooks.metadata.pdf', 'read_info', (pdfpath,
bool(cover)))
try:
res = fork_job('calibre.ebooks.metadata.pdf', 'read_info',
(pdfpath, bool(cover)))
except WorkerError as e:
prints(e.orig_tb)
raise RuntimeError('Failed to run pdfinfo')
info = res['result']
with open(res['stdout_stderr'], 'rb') as f:
raw = f.read().strip()
Expand Down

0 comments on commit 4c24997

Please sign in to comment.