斗鱼优化,防止在直播的主播不录制

This commit is contained in:
liuwei
2026-02-24 17:37:08 +08:00
parent 9d02b264e2
commit 5845a336ef

View File

@@ -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}")