Minor text bugfix. Stopped from spawning multiple processess when only 1 link to be downloaded.
This commit is contained in:
parent
79418e492c
commit
e4368e142c
@ -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,7 +209,9 @@ 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:
|
||||||
|
downloader([urls[0], inout_file, path, live])
|
||||||
|
else:
|
||||||
p = Pool()
|
p = Pool()
|
||||||
p.map(downloader, [[url, inout_file, path, live] for url in urls])
|
p.map(downloader, [[url, inout_file, path, live] for url in urls])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user