diff --git a/plugins/douyu/main.py b/plugins/douyu/main.py index 91abc9a..6be5ada 100644 --- a/plugins/douyu/main.py +++ b/plugins/douyu/main.py @@ -35,7 +35,7 @@ class DouyuDanmuRecorder: self._stop_event = threading.Event() self._ws: Optional[websocket.WebSocketApp] = None self._buffer: List[str] = [] - self._buffer_limit = 50 + self._buffer_limit = 10 self._buffer_date: Optional[str] = None self._lock = threading.Lock() self._websocket_available = websocket is not None @@ -542,6 +542,13 @@ class DouyuPlugin(MessagePluginInterface): if prev_live is True and curr_live is False: await self._notify_groups_offline(room_id, nickname, room_name, video_loop == 1) continue + if prev_live is True and curr_live is True and room_id not in self._danmu_recorders: + try: + logger.info(f"检测到持续直播状态,补偿启动斗鱼弹幕记录({room_id})") + self._start_danmu_record(room_id) + except Exception as e: + logger.error(f"补偿启动斗鱼弹幕记录失败({room_id}): {e}") + continue await asyncio.sleep(0.1) except Exception as e: logger.error(f"斗鱼检查失败: {e}")