From d18952a72e4b6dbfc5ca935df2e2e9fe78adb442 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 4 Dec 2024 03:57:56 +0800 Subject: [PATCH] Update index.py --- plugins/migration_api/index.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/migration_api/index.py b/plugins/migration_api/index.py index 11521d95f..ebec628ed 100755 --- a/plugins/migration_api/index.py +++ b/plugins/migration_api/index.py @@ -1021,18 +1021,18 @@ def getSpeed(): path = getServerDir() + '/config/speed.json' if not os.path.exists(path): return mw.returnJson(False, '正在准备..') + try: speed_info = json.loads(mw.readFile(path)) - except: - return mw.returnJson(False, '正在准备..') + except Exception as e: + return mw.returnJson(True, str(e)+'...') data = getCfgData() api = classApi(data['url'], data['app_id'], data['app_secret']) sync_info = api.get_sync_info(None) speed_info['all_total'] = sync_info['total'] speed_info['all_speed'] = sync_info['speed'] speed_info['total_time'] = speed_info['end_time'] - speed_info['time'] - speed_info['total_time'] = str(int(speed_info[ - 'total_time'] // 60)) + "分" + str(int(speed_info['total_time'] % 60)) + "秒" + speed_info['total_time'] = str(int(speed_info['total_time'] // 60)) + "分" + str(int(speed_info['total_time'] % 60)) + "秒" log_file = getServerDir() + '/sync.log' speed_info['log'] = mw.execShell("tail -n 10 {}".format(log_file))[0] speed_info['log_file'] = log_file