From a307760dcc47aef065241fc7d860c696e8f4a08a Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Fri, 18 Oct 2019 23:20:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Common.py b/Common.py index db347b9..bb9e919 100644 --- a/Common.py +++ b/Common.py @@ -86,17 +86,18 @@ def getTimeDelta(a, b): def _doClean(_force=False): global doCleanTime, _clean_flag _disk = psutil.disk_usage(".") - if (_disk.percent > config["max"] and getTimeDelta(datetime.now(), doCleanTime) > config["exp"]*86400) or _force: + if _disk.percent > 95 or _disk.percent > config["max"] or getTimeDelta(datetime.now(), doCleanTime) > config["exp"]*86400 or _force: _clean_flag = True doCleanTime = datetime.now() + appendOperation("执行配置的清理命令") os.system(config["dow"]) + appendOperation("执行配置的清理命令完毕") doCleanTime = datetime.now() _clean_flag = False def doClean(_force=False): if _clean_flag: - appendError("doClean request on cleaning, will ignore it") return p = threading.Thread(target=_doClean, args=(_force,)) p.setDaemon(True) @@ -115,8 +116,6 @@ def getCurrentStatus(): _outSpeed = (network[-1]["in"]["currentByte"] - network[-2]["in"]["currentByte"]) _inSpeed = (network[-1]["out"]["currentByte"] - network[-2]["out"]["currentByte"]) updateNetwork() - if getTimeDelta(datetime.now(), doCleanTime) > 3600: - doClean() return { "memTotal": parseSize(_mem.total), "memUsed": parseSize(_mem.used), @@ -291,6 +290,11 @@ def loginBilibili(): class downloader(XiGuaLiveApi): playlist = None + + def updRoomInfo(self): + doClean() + super(downloader, self).updRoomInfo() + def _updateRoomOnly(self): global broadcaster, isBroadcasting, updateTime super(downloader, self)._updateRoomOnly()