From d4f626f2850d911dff71f5f86ef257455ca17aee Mon Sep 17 00:00:00 2001 From: yjqiang Date: Fri, 12 Apr 2019 17:37:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BD=E6=95=B0=E5=A5=BD=E5=A5=BD=E5=B9=B2?= =?UTF-8?q?=E6=B4=BB=20=E5=88=AB=E6=83=B3=E7=9D=80=E6=90=9E=E6=96=B0?= =?UTF-8?q?=E9=97=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit print尽量要返回后执行 --- danmu/bili_danmu_monitor.py | 9 +++++---- tasks/utils.py | 3 --- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/danmu/bili_danmu_monitor.py b/danmu/bili_danmu_monitor.py index 393e6c1..f19a57c 100644 --- a/danmu/bili_danmu_monitor.py +++ b/danmu/bili_danmu_monitor.py @@ -51,12 +51,13 @@ async def _prepare_client(self): self._room_id = await notifier.exec_func( -1, UtilsTask.get_room_by_area, self._area_id, self._room_id) + print(f'{self._area_id}号数据连接选择房间({self._room_id})') def handle_danmu(self, data: dict): cmd = data['cmd'] if cmd == 'PREPARING': - print(f'{self._area_id}号弹幕监控房间下播({self._room_id})') + print(f'{self._area_id}号数据连接房间下播({self._room_id})') return False elif cmd == 'NOTICE_MSG': @@ -82,19 +83,19 @@ def handle_danmu(self, data: dict): raffle_num = 1 raffle_name = str_gift broadcast = msg_common.split('广播')[0] - print(f'{self._area_id}号弹幕监控检测到{real_roomid:^9}的{raffle_name}') + print(f'{self._area_id}号数据连接检测到{real_roomid:^9}的{raffle_name}') raffle_handler.push2queue(TvRaffleHandlerTask, real_roomid) broadcast_type = 0 if broadcast == '全区' else 1 bili_statistics.add2pushed_raffles(raffle_name, broadcast_type, raffle_num) elif msg_type == 3: raffle_name = msg_common.split('开通了')[-1][:2] - print(f'{self._area_id}号弹幕监控检测到{real_roomid:^9}的{raffle_name}') + print(f'{self._area_id}号数据连接检测到{real_roomid:^9}的{raffle_name}') raffle_handler.push2queue(GuardRaffleHandlerTask, real_roomid) broadcast_type = 0 if raffle_name == '总督' else 2 bili_statistics.add2pushed_raffles(raffle_name, broadcast_type) elif msg_type == 6: raffle_name = '二十倍节奏风暴' - print(f'{self._area_id}号弹幕监控检测到{real_roomid:^9}的{raffle_name}') + print(f'{self._area_id}号数据连接检测到{real_roomid:^9}的{raffle_name}') # raffle_handler.push2queue(StormRaffleHandlerTask, real_roomid) bili_statistics.add2pushed_raffles(raffle_name) return True diff --git a/tasks/utils.py b/tasks/utils.py index 96de177..3fd3fe1 100644 --- a/tasks/utils.py +++ b/tasks/utils.py @@ -47,12 +47,10 @@ async def get_room_by_area(user, area_id, room_id=None): # None/0 都不行 if room_id is not None and room_id: if await UtilsTask.is_ok_as_monitor(user, room_id, area_id): - printer.infos([f'{area_id}号弹幕监控选择房间({room_id})']) return room_id if area_id == 1: room_id = 23058 if await UtilsTask.is_ok_as_monitor(user, room_id, area_id): - printer.infos([f'{area_id}号弹幕监控选择房间({room_id})']) return room_id while True: @@ -60,7 +58,6 @@ async def get_room_by_area(user, area_id, room_id=None): data = json_rsp['data'] room_id = random.choice(data)['roomid'] if await UtilsTask.is_ok_as_monitor(user, room_id, area_id): - printer.infos([f'{area_id}号弹幕监控选择房间({room_id})']) return room_id @staticmethod