You've already forked XiguaLiveDanmakuHelper
支持显示网速
This commit is contained in:
24
WebMain.py
24
WebMain.py
@ -6,7 +6,6 @@ from flask import Flask, jsonify, request, redirect, render_template, Response
|
||||
import Common
|
||||
import threading
|
||||
from liveDownloader import run as RUN
|
||||
import psutil
|
||||
|
||||
app = Flask("liveStatus")
|
||||
app.config['JSON_AS_ASCII'] = False
|
||||
@ -17,7 +16,8 @@ CORS(app, supports_credentials=True)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return redirect("/static/index.html")
|
||||
return render_template("index.html")
|
||||
|
||||
|
||||
@app.route("/config", methods=["GET"])
|
||||
def readConfig():
|
||||
@ -90,7 +90,6 @@ def finishUpload():
|
||||
|
||||
@app.route("/stats", methods=["GET"])
|
||||
def getAllStats():
|
||||
_disk = psutil.disk_usage("/")
|
||||
return jsonify({"message":"ok","code":200,"status":0,"data":{
|
||||
"download":Common.downloadStatus,
|
||||
"encode": Common.encodeStatus,
|
||||
@ -115,18 +114,8 @@ def getAllStats():
|
||||
|
||||
@app.route("/stats/device", methods=["GET"])
|
||||
def getDeviceStatus():
|
||||
_disk = psutil.disk_usage("/")
|
||||
_mem = psutil.virtual_memory()
|
||||
return jsonify({"message":"ok","code":200,"status":0,"data":{
|
||||
"status": {
|
||||
"memTotal": Common.parseSize(_mem.total),
|
||||
"memUsed": Common.parseSize(_mem.used),
|
||||
"memUsage": _mem.percent,
|
||||
"diskTotal": Common.parseSize(_disk.total),
|
||||
"diskUsed": Common.parseSize(_disk.used),
|
||||
"diskUsage": _disk.percent,
|
||||
"cpu": psutil.cpu_percent(),
|
||||
},
|
||||
"status": Common.getCurrentStatus(),
|
||||
}})
|
||||
|
||||
|
||||
@ -149,6 +138,7 @@ def getConfigStats():
|
||||
"forceNotBroadcasting": Common.forceNotBroadcasting,
|
||||
"forceNotDownload": Common.forceNotDownload,
|
||||
"forceNotUpload": Common.forceNotUpload,
|
||||
"forceNotEncode": Common.forceNotEncode,
|
||||
}
|
||||
}})
|
||||
|
||||
@ -212,6 +202,6 @@ def SubThread():
|
||||
t.start()
|
||||
|
||||
|
||||
p = threading.Thread(target = SubThread)
|
||||
p.setDaemon(True)
|
||||
p.start()
|
||||
# p = threading.Thread(target=SubThread)
|
||||
# p.setDaemon(True)
|
||||
# p.start()
|
||||
|
Reference in New Issue
Block a user