From ac7b0d7e0e07e602c3fa21cbfb31bd4c6a61801e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damjan=20Ko=C5=A1ir?= Date: Sun, 26 Apr 2015 00:19:08 +1200 Subject: [PATCH] adding parallel run option --- dosage | 1 + dosagelib/director.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dosage b/dosage index 5a0cd5612..a18466db8 100755 --- a/dosage +++ b/dosage @@ -75,6 +75,7 @@ def setupOptions(): parser.add_argument('-m', '--modulehelp', action='store_true', help='display help for comic modules') parser.add_argument('-t', '--timestamps', action='store_true', help='print timestamps for all output at any info level') parser.add_argument('-o', '--output', action='append', dest='handler', choices=events.getHandlerNames(), help='sets output handlers for downloaded comics') + parser.add_argument('-p', '--parallel', action='store', type=int, default=1, help='fetch comics in parallel. Specify the number of connections') parser.add_argument('--adult', action='store_true', help='confirms that you are old enough to view adult content') # used for development testing prev/next matching parser.add_argument('--dry-run', action='store_true', help=argparse.SUPPRESS) diff --git a/dosagelib/director.py b/dosagelib/director.py index f18593536..474c497fe 100644 --- a/dosagelib/director.py +++ b/dosagelib/director.py @@ -161,7 +161,7 @@ def getComics(options): for scraperobj in getScrapers(options.comic, options.basepath, options.adult, options.multimatch): jobs.put(scraperobj) # start threads - num_threads = 1# XXX max(1, min(10, jobs.qsize())) + num_threads = max(1, min(options.parallel, jobs.qsize())) for i in range(num_threads): t = ComicGetter(options) threads.append(t)