From fe6816282fd987aa8963ccf57f958fe462f42b22 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Oct 2010 14:29:32 -0600 Subject: [PATCH] Fix #7071 (Download of metadata for multiple books has strange behaivour) --- src/calibre/devices/apple/driver.py | 1 - src/calibre/gui2/metadata.py | 10 ++++++++-- src/calibre/library/cli.py | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/calibre/devices/apple/driver.py b/src/calibre/devices/apple/driver.py index 0fd2bbcc2c..2ffe6399e4 100644 --- a/src/calibre/devices/apple/driver.py +++ b/src/calibre/devices/apple/driver.py @@ -19,7 +19,6 @@ from calibre.ebooks.metadata.epub import set_metadata from calibre.library.server.utils import strftime from calibre.utils.config import config_dir, prefs from calibre.utils.date import isoformat, now, parse_date -from calibre.utils.localization import get_lang from calibre.utils.logging import Log from calibre.utils.zipfile import ZipFile diff --git a/src/calibre/gui2/metadata.py b/src/calibre/gui2/metadata.py index b11e2ad28a..45cda50433 100644 --- a/src/calibre/gui2/metadata.py +++ b/src/calibre/gui2/metadata.py @@ -144,10 +144,10 @@ class DownloadMetadata(Thread): def commit_covers(self, all=False): if all: - self.worker.jobs.put(False) + self.worker.jobs.put((False, False)) while True: try: - id, fmi, ok, cdata = self.worker.results.get(False) + id, fmi, ok, cdata = self.worker.results.get_nowait() if ok: self.fetched_covers[id] = cdata self.results.put((id, 'cover', ok, fmi.title)) @@ -210,6 +210,12 @@ class DoDownload(QObject): pass if not self.downloader.is_alive(): self.timer.stop() + while True: + try: + r = self.downloader.results.get_nowait() + self.handle_result(r) + except Empty: + break self.pd.accept() def handle_result(self, r): diff --git a/src/calibre/library/cli.py b/src/calibre/library/cli.py index c1a1109cf8..a11d81cc8c 100644 --- a/src/calibre/library/cli.py +++ b/src/calibre/library/cli.py @@ -1010,7 +1010,6 @@ def command_restore_database(args, dbpath): 'saved to', name) def list_categories_option_parser(): - from calibre.library.check_library import CHECKS parser = get_parser(_('''\ %prog list_categories [options]