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: for each in result:
book={} book={}
if 'http' in each.manga.name or 'https' in each.manga.url: 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: 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['title'] = each.manga.name
book['command'] = execute # book['command'] = 'nothing'
# os.system(execute) # os.system(execute)
exec_command = subprocess.Popen(execute, stdout=subprocess.PIPE) # exec_command = subprocess.Popen(execute, stdout=subprocess.PIPE)
book['output'] = exec_command.stdout.read() book['output'] = exec_command.communicate()
updated.append(book) updated.append(book)
missing = check(passin=1) missing = check(passin=1)