From 586ef378741b95619f398b66fda9399f5d6e6c9c Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Sep 2019 21:13:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BF=BD=E7=95=A5=E4=BA=8630?= =?UTF-8?q?=E5=88=86=E9=92=9F=E5=86=85=E4=BB=8E=E6=96=B0=E5=BC=80=E6=92=AD?= =?UTF-8?q?=E7=9A=84=E5=8F=AF=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liveDownloader.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/liveDownloader.py b/liveDownloader.py index 0435bd0..e381ed8 100644 --- a/liveDownloader.py +++ b/liveDownloader.py @@ -157,10 +157,10 @@ def run(): return awakeEncode() _count = 0 - _firstDown = False + _firstDown = 0 while True: if Common.api.isLive and not Common.forceNotBroadcasting: - _firstDown = True + _firstDown = 0 if not Common.forceNotDownload: awakeDownload() awakeUpload() @@ -176,17 +176,6 @@ def run(): continue time.sleep(5) else: - if not isEncode and not isDownload: - if _firstDown: - sleep(1800) # 防抖,避免主播因特殊情况下播导致直接投递了 - Common.api.updRoomInfo() - _firstDown = False - continue - Common.uploadQueue.put(True) - _firstDown = False - isEncode = True - isDownload = True - time.sleep(60) try: Common.api.updRoomInfo() except Exception as e: @@ -200,3 +189,14 @@ def run(): if Common.forceStartUploadThread: awakeUpload() Common.forceStartUploadThread = False + if not isEncode and not isDownload: + # 防抖,避免主播因特殊情况下播导致直接投递了 + if _firstDown < 30: + _firstDown += 1 + sleep(60) + continue + Common.uploadQueue.put(True) + _firstDown = 0 + isEncode = True + isDownload = True + time.sleep(60)