Fix cover download failing on some non-english windows installs

This commit is contained in:
Kovid Goyal 2012-04-12 15:20:24 +05:30
parent b24bde150d
commit b7d0609ac8
3 changed files with 9 additions and 6 deletions

View File

@ -48,7 +48,8 @@ def merge_result(oldmi, newmi, ensure_fields=None):
return newmi
def main(do_identify, covers, metadata, ensure_fields):
def main(do_identify, covers, metadata, ensure_fields, tdir):
os.chdir(tdir)
failed_ids = set()
failed_covers = set()
all_failed = True
@ -103,7 +104,8 @@ def single_identify(title, authors, identifiers):
return [metadata_to_opf(r) for r in results], [r.has_cached_cover_url for
r in results], dump_caches(), log.dump()
def single_covers(title, authors, identifiers, caches):
def single_covers(title, authors, identifiers, caches, tdir):
os.chdir(tdir)
load_caches(caches)
log = GUILog()
results = Queue()

View File

@ -232,8 +232,8 @@ def download(all_ids, tf, db, do_identify, covers, ensure_fields,
metadata.iteritems()}
try:
ret = fork_job('calibre.ebooks.metadata.sources.worker', 'main',
(do_identify, covers, metadata, ensure_fields),
cwd=tdir, abort=abort, heartbeat=heartbeat, no_output=True)
(do_identify, covers, metadata, ensure_fields, tdir),
abort=abort, heartbeat=heartbeat, no_output=True)
except WorkerError as e:
if e.orig_tb:
raise Exception('Failed to download metadata. Original '

View File

@ -573,8 +573,9 @@ class CoverWorker(Thread): # {{{
try:
res = fork_job('calibre.ebooks.metadata.sources.worker',
'single_covers',
(self.title, self.authors, self.identifiers, self.caches),
cwd=tdir, no_output=True, abort=self.abort)
(self.title, self.authors, self.identifiers, self.caches,
tdir),
no_output=True, abort=self.abort)
self.log.append_dump(res['result'])
finally:
self.keep_going = False