From 74120850a408360cf7b2468a5edeb6e9fc1b3c48 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Thu, 9 Jan 2020 09:26:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=B5=E6=B4=BB=E4=B8=8B=E6=92=AD=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common.py | 8 +++----- api.py | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Common.py b/Common.py index 30e2158..4b04efe 100644 --- a/Common.py +++ b/Common.py @@ -153,7 +153,6 @@ dt_format = "%Y/%m/%d %H:%M:%S" reloadConfig() broadcaster = "" streamUrl = "" -isBroadcasting = False updateTime = "" forceNotDownload = False @@ -308,16 +307,15 @@ class downloader(XiGuaLiveApi): playlist = None def updRoomInfo(self, force=False): - global broadcaster, isBroadcasting, updateTime + global broadcaster, updateTime _prev_status = self.isLive doClean() _result = super(downloader, self).updRoomInfo(force) - updateTime = datetime.strftime(datetime.now(), dt_format) + updateTime = datetime.now().strftime(dt_format) if _prev_status != self.isLive: resetDelay() if _result: broadcaster = self.broadcaster - isBroadcasting = self.isLive if self.isLive: self.updPlayList() else: @@ -397,7 +395,7 @@ def collectInfomation(): "operation": operations, "broadcast": { "broadcaster": broadcaster.__str__(), - "isBroadcasting": isBroadcasting, + "isBroadcasting": api.isLive, "streamUrl": streamUrl, "updateTime": updateTime, "delayTime": delay.strftime(dt_format) diff --git a/api.py b/api.py index 9c53202..3c36f8c 100644 --- a/api.py +++ b/api.py @@ -176,6 +176,7 @@ class XiGuaLiveApi: :return: """ if self.broadcaster is None: + self.isValidUser = False return False _formatData = {"COMMON": COMMON_GET_PARAM, "TIMESTAMP": time.time() * 1000, "userId": self.broadcaster.ID} _url = USER_INFO_API.format_map(_formatData).format_map(_formatData) @@ -199,6 +200,7 @@ class XiGuaLiveApi: def _getRoomInfo(self, force=False): if self.roomID == 0: + self.isLive = False return False if not force or (self._updRoomAt + timedelta(minutes=2) > datetime.now()): return self.isLive