attempting to capture manga-py output in response.
This commit is contained in:
7
main.py
7
main.py
@@ -2,6 +2,7 @@ from flask_sqlalchemy import SQLAlchemy
|
|||||||
from flask import Flask, jsonify, render_template, request
|
from flask import Flask, jsonify, render_template, request
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
PATH = '/download'
|
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"""
|
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['title'] = each.manga.name
|
||||||
book['command'] = execute
|
book['command'] = execute
|
||||||
|
|
||||||
|
# os.system(execute)
|
||||||
|
exec_command = subprocess.Popen(execute, stdout=subprocess.PIPE)
|
||||||
|
book['output'] = exec_command.stdout.read()
|
||||||
updated.append(book)
|
updated.append(book)
|
||||||
os.system(execute)
|
|
||||||
missing = check(passin=1)
|
missing = check(passin=1)
|
||||||
return jsonify(manga=updated, missingFlags=missing[0], missingManga=missing[1])
|
return jsonify(manga=updated, missingFlags=missing[0], missingManga=missing[1])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user