From 22925398dad22bfa8e81b4f77b14aa40fa5c7330 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sun, 12 May 2019 19:31:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=A0=E8=A5=BF=E7=93=9C?= =?UTF-8?q?=E7=9B=B4=E6=92=AD=E6=90=9C=E7=B4=A2=E6=8E=A5=E5=8F=A3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AF=BC=E8=87=B4=E7=9A=84=E6=97=A0=E6=B3=95=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=9B=B4=E6=92=AD=E7=94=A8=E6=88=B7=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WinMain.py | 10 +++++++--- liveDownloader.py | 10 ++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/WinMain.py b/WinMain.py index c5a7011..294e088 100644 --- a/WinMain.py +++ b/WinMain.py @@ -185,10 +185,14 @@ if __name__ == "__main__": else: name = readInput("请输入主播用户名,默认为", name, 3) api = WinMain(name) - print("进入", api.roomLiver, "的直播间") - if not api.isValidRoom: - input("房间不存在") + while not api.isValidRoom: + set_cmd_text_color(FOREGROUND_RED) + print("未找到对应房间或未开播,等待1分钟后重试") + resetColor() + time.sleep(60) + api.updRoomInfo() sys.exit() + print("进入", api.roomLiver, "的直播间") os.system("title {}".format(api.getTitle())) print("=" * 30) while True: diff --git a/liveDownloader.py b/liveDownloader.py index 43c45a7..e827bdc 100644 --- a/liveDownloader.py +++ b/liveDownloader.py @@ -107,14 +107,16 @@ def upload(date=datetime.strftime(datetime.now(), "%Y_%m_%d")): b = Bilibili() b.login(Common.config["b_u"], Common.config["b_p"]) +et = threading.Thread(target=encode, args=()) +et.setDaemon(True) +et.start() + def run(): global isEncode, isDownload - et = threading.Thread(target=encode, args=()) - et.setDaemon(True) - et.start() + Common.refreshDownloader() if not Common.api.isValidRoom: - Common.appendError("[{}]房间不存在".format(Common.config["l_u"])) + Common.appendError("[{}]房间未找到".format(Common.config["l_u"])) return d = None t = threading.Thread(target=download)