From b61bd4c70c4046c12c5162e58b5bda6b8a7eca45 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sat, 11 May 2019 21:21:43 +0800 Subject: [PATCH] Avoid loop in Boardcaster is not found and stop download --- Common.py | 7 ++++++- liveDownloader.py | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Common.py b/Common.py index 96e727b..265d968 100644 --- a/Common.py +++ b/Common.py @@ -314,4 +314,9 @@ class downloader(XiGuaLiveApi): pass -api = downloader(config["l_u"]) \ No newline at end of file +api = downloader(config["l_u"]) + + +def refreshDownloader(): + global api + api = downloader(config["l_u"]) diff --git a/liveDownloader.py b/liveDownloader.py index e10d4ae..43c45a7 100644 --- a/liveDownloader.py +++ b/liveDownloader.py @@ -177,6 +177,9 @@ def run(): _count_error = 0 except Exception as e: Common.appendError(e.__str__()) + _count_error += 1 + if not Common.api.roomLiver: + _count_error += 1 if Common.forceStartEncodeThread: if not et.is_alive(): et = threading.Thread(target=encode, args=()) @@ -190,3 +193,5 @@ def run(): ut.setDaemon(True) ut.start() Common.forceStartUploadThread = False + if _count_error>10: + Common.refreshDownloader()