From 204d8342bbf83ee9fab3cb024ec3cb762f913fe0 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sat, 19 Oct 2019 08:27:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Common.py b/Common.py index baee9fc..3c10854 100644 --- a/Common.py +++ b/Common.py @@ -36,11 +36,6 @@ config = { # 下播延迟投稿 "dly": 30 } - -_config_fp = open("config.json", "r", encoding="utf8") -_config = json.load(_config_fp) -_config_fp.close() -del _config_fp doCleanTime = datetime.now() _clean_flag = None delay = 30 @@ -65,6 +60,15 @@ network = [{ }] +def reloadConfig(): + global config + if(os.path.exists(config.json)): + _config_fp = open("config.json", "r", encoding="utf8") + _config = json.load(_config_fp) + config.update(_config) + _config_fp.close() + + def resetDelay(): global delay delay = config['dly'] @@ -147,16 +151,8 @@ def getCurrentStatus(): } -def reloadConfig(): - global config - _config_fp = open("config.json", "r", encoding="utf8") - _config = json.load(_config_fp) - config.update(_config) - _config_fp.close() - - dt_format = "%Y/%m/%d %H:%M:%S" - +reloadConfig() broadcaster = "" streamUrl = "" isBroadcasting = False