Minor text bugfix. Stopped from spawning multiple processess when only 1 link to be downloaded.

This commit is contained in:
MrTyton 2017-08-15 19:56:05 -04:00
parent 79418e492c
commit e4368e142c

View File

@ -136,6 +136,7 @@ def downloader(args):
try: try:
res = check_output('calibredb remove {} {}'.format(path, storyId), shell=True,stderr=STDOUT,stdin=PIPE, ) res = check_output('calibredb remove {} {}'.format(path, storyId), shell=True,stderr=STDOUT,stdin=PIPE, )
except: except:
if not live: print output.strip()
raise raise
output += log("\tAdding {} to library".format(cur), 'BLUE', live) output += log("\tAdding {} to library".format(cur), 'BLUE', live)
@ -143,6 +144,7 @@ def downloader(args):
res = check_output('calibredb add -d {} "{}"'.format(path, cur), shell=True,stderr=STDOUT,stdin=PIPE, ) res = check_output('calibredb add -d {} "{}"'.format(path, cur), shell=True,stderr=STDOUT,stdin=PIPE, )
except Exception as e: except Exception as e:
output += log(e) output += log(e)
if not live: print output.strip()
raise raise
try: try:
res = check_output('calibredb search "Identifiers:{}" {}'.format(url, path), shell=True, stderr=STDOUT,stdin=PIPE, ) res = check_output('calibredb search "Identifiers:{}" {}'.format(url, path), shell=True, stderr=STDOUT,stdin=PIPE, )
@ -207,9 +209,11 @@ def main(user, password, server, label, inout_file, path, live ):
log("URLs to parse ({}):".format(len(urls)), 'HEADER') log("URLs to parse ({}):".format(len(urls)), 'HEADER')
for url in urls: for url in urls:
log("\t{}".format(url), 'BLUE') log("\t{}".format(url), 'BLUE')
if len(urls) == 1:
p = Pool() downloader([urls[0], inout_file, path, live])
p.map(downloader, [[url, inout_file, path, live] for url in urls]) else:
p = Pool()
p.map(downloader, [[url, inout_file, path, live] for url in urls])
return return