Adjusted subprocess calls

This commit is contained in:
Dan Dembinski
2020-03-20 11:01:02 -04:00
parent e1b4be2d40
commit 23a8bc0d42

13
main.py
View File

@@ -50,15 +50,18 @@ def download():
for each in result:
book={}
if 'http' in each.manga.name or 'https' in each.manga.url:
execute = """manga-py """ + each.manga.url + """ -n \"""" + each.manga.name + """\" -d \"""" + PATH + """\" -z -N --print-json"""
# execute = """manga-py """ + each.manga.url + """ -n \"""" + each.manga.name + """\" -d \"""" + PATH + """\" -z -N --print-json"""
exec_command = subprocess.Popen(['manga-py', each.manga.url, '-n', each.manga.name, '-d', PATH, '-z', '-N', '--print-json'], stdout=subprocess.PIPE)
else:
execute = """manga-py """ + each.url_metadata.base_url+each.manga.url + """ -n \"""" + each.manga.name.strip('?') + """\" -d \"""" + PATH + """\" -z -N --print-json"""
print('nothing')
# execute = """manga-py """ + each.url_metadata.base_url+each.manga.url + """ -n \"""" + each.manga.name.strip('?') + """\" -d \"""" + PATH + """\" -z -N --print-json"""
exec_command = subprocess.Popen(['manga-py', each.url_metadata.base_url, each.manga.url, '-n', each.manga.name.strip('?'), '-d', PATH, '-z', '-N', '--print-json'], stdout=subprocess.PIPE)
book['title'] = each.manga.name
book['command'] = execute
# book['command'] = 'nothing'
# os.system(execute)
exec_command = subprocess.Popen(execute, stdout=subprocess.PIPE)
book['output'] = exec_command.stdout.read()
# exec_command = subprocess.Popen(execute, stdout=subprocess.PIPE)
book['output'] = exec_command.communicate()
updated.append(book)
missing = check(passin=1)