添加:系统信息查看
This commit is contained in:
parent
14430e79ef
commit
78fe5582e6
22
WebMain.py
22
WebMain.py
@ -6,6 +6,7 @@ from flask import Flask, jsonify, request, redirect, render_template, Response
|
|||||||
import Common
|
import Common
|
||||||
import threading
|
import threading
|
||||||
from liveDownloader import run as RUN
|
from liveDownloader import run as RUN
|
||||||
|
import psutil
|
||||||
|
|
||||||
app = Flask("liveStatus")
|
app = Flask("liveStatus")
|
||||||
app.config['JSON_AS_ASCII'] = False
|
app.config['JSON_AS_ASCII'] = False
|
||||||
@ -57,6 +58,7 @@ def finishUpload():
|
|||||||
|
|
||||||
@app.route("/stats", methods=["GET"])
|
@app.route("/stats", methods=["GET"])
|
||||||
def getAllStats():
|
def getAllStats():
|
||||||
|
_disk = psutil.disk_usage("/")
|
||||||
return jsonify({"message":"ok","code":200,"status":0,"data":{
|
return jsonify({"message":"ok","code":200,"status":0,"data":{
|
||||||
"download":Common.downloadStatus,
|
"download":Common.downloadStatus,
|
||||||
"encode": Common.encodeStatus,
|
"encode": Common.encodeStatus,
|
||||||
@ -74,8 +76,24 @@ def getAllStats():
|
|||||||
"forceNotBroadcasting": Common.forceNotBroadcasting,
|
"forceNotBroadcasting": Common.forceNotBroadcasting,
|
||||||
"forceStopDownload": Common.forceStopDownload,
|
"forceStopDownload": Common.forceStopDownload,
|
||||||
"forceNotUpload": Common.forceNotUpload,
|
"forceNotUpload": Common.forceNotUpload,
|
||||||
"forceNotEncode": Common.forceNotEncode,
|
},
|
||||||
}
|
}})
|
||||||
|
|
||||||
|
|
||||||
|
@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(),
|
||||||
|
},
|
||||||
}})
|
}})
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ def encode():
|
|||||||
|
|
||||||
|
|
||||||
def upload(date=datetime.strftime(datetime.now(), "%Y_%m_%d")):
|
def upload(date=datetime.strftime(datetime.now(), "%Y_%m_%d")):
|
||||||
i = uploadQueue.get()
|
|
||||||
appendUploadStatus("Upload Daemon Starting")
|
appendUploadStatus("Upload Daemon Starting")
|
||||||
|
i = uploadQueue.get()
|
||||||
while True:
|
while True:
|
||||||
if forceNotUpload:
|
if forceNotUpload:
|
||||||
modifyLastUploadStatus("设置了不上传,所以[{}]不会上传了".format(i))
|
modifyLastUploadStatus("设置了不上传,所以[{}]不会上传了".format(i))
|
||||||
|
Reference in New Issue
Block a user