From 5806e02f97b3e604083f9e191e43ed150181c5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 10 Apr 2015 17:31:49 +0200 Subject: [PATCH] better support for KeyboardInterrupt exceptions --- gallery_dl/__init__.py | 7 +++++-- gallery_dl/extractor/common.py | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gallery_dl/__init__.py b/gallery_dl/__init__.py index 2e5e2fca..bc69b15c 100644 --- a/gallery_dl/__init__.py +++ b/gallery_dl/__init__.py @@ -54,5 +54,8 @@ def main(): conf = parse_config_file(opts.config) dlmgr = DownloadManager(opts, conf) - for url in opts.urls: - dlmgr.add(url) + try: + for url in opts.urls: + dlmgr.add(url) + except KeyboardInterrupt: + print("KeyboardInterrupt") diff --git a/gallery_dl/extractor/common.py b/gallery_dl/extractor/common.py index 60c9beab..cb8e91ca 100644 --- a/gallery_dl/extractor/common.py +++ b/gallery_dl/extractor/common.py @@ -75,8 +75,7 @@ class AsynchronousExtractor(Extractor): Extractor.__init__(self) queue_size = int(config.get("general", "queue-size", fallback=5)) self.__queue = queue.Queue(maxsize=queue_size) - self.__thread = threading.Thread(target=self.async_items) - # self.__thread = threading.Thread(target=self.async_images, daemon=True) + self.__thread = threading.Thread(target=self.async_items, daemon=True) def __iter__(self): get = self.__queue.get