attempting to capture manga-py output in response.

This commit is contained in:
Dan Dembinski
2020-03-20 10:13:01 -04:00
parent db1b5e4af2
commit e1b4be2d40

View File

@@ -2,6 +2,7 @@ from flask_sqlalchemy import SQLAlchemy
from flask import Flask, jsonify, render_template, request
import json
import os
import subprocess
PATH = '/download'
@@ -54,8 +55,12 @@ def download():
execute = """manga-py """ + each.url_metadata.base_url+each.manga.url + """ -n \"""" + each.manga.name.strip('?') + """\" -d \"""" + PATH + """\" -z -N --print-json"""
book['title'] = each.manga.name
book['command'] = execute
# os.system(execute)
exec_command = subprocess.Popen(execute, stdout=subprocess.PIPE)
book['output'] = exec_command.stdout.read()
updated.append(book)
os.system(execute)
missing = check(passin=1)
return jsonify(manga=updated, missingFlags=missing[0], missingManga=missing[1])