Update index.py

pull/632/head
Mr Chen 5 months ago
parent f1478369b5
commit d18952a72e
  1. 8
      plugins/migration_api/index.py

@ -1021,18 +1021,18 @@ def getSpeed():
path = getServerDir() + '/config/speed.json' path = getServerDir() + '/config/speed.json'
if not os.path.exists(path): if not os.path.exists(path):
return mw.returnJson(False, '正在准备..') return mw.returnJson(False, '正在准备..')
try: try:
speed_info = json.loads(mw.readFile(path)) speed_info = json.loads(mw.readFile(path))
except: except Exception as e:
return mw.returnJson(False, '正在准备..') return mw.returnJson(True, str(e)+'...')
data = getCfgData() data = getCfgData()
api = classApi(data['url'], data['app_id'], data['app_secret']) api = classApi(data['url'], data['app_id'], data['app_secret'])
sync_info = api.get_sync_info(None) sync_info = api.get_sync_info(None)
speed_info['all_total'] = sync_info['total'] speed_info['all_total'] = sync_info['total']
speed_info['all_speed'] = sync_info['speed'] speed_info['all_speed'] = sync_info['speed']
speed_info['total_time'] = speed_info['end_time'] - speed_info['time'] speed_info['total_time'] = speed_info['end_time'] - speed_info['time']
speed_info['total_time'] = str(int(speed_info[ speed_info['total_time'] = str(int(speed_info['total_time'] // 60)) + "" + str(int(speed_info['total_time'] % 60)) + ""
'total_time'] // 60)) + "" + str(int(speed_info['total_time'] % 60)) + ""
log_file = getServerDir() + '/sync.log' log_file = getServerDir() + '/sync.log'
speed_info['log'] = mw.execShell("tail -n 10 {}".format(log_file))[0] speed_info['log'] = mw.execShell("tail -n 10 {}".format(log_file))[0]
speed_info['log_file'] = log_file speed_info['log_file'] = log_file

Loading…
Cancel
Save