diff --git a/fudai_detail_modules/fudai_detail_reader.py b/fudai_detail_modules/fudai_detail_reader.py index 31b9786..883c550 100644 --- a/fudai_detail_modules/fudai_detail_reader.py +++ b/fudai_detail_modules/fudai_detail_reader.py @@ -370,6 +370,34 @@ def read_fudai_detail_once(analyser: Any) -> Tuple[str, Tuple, dict]: try: ocr_start = time.time() + + # 在开始OCR识别前,先识别直播间标题 + try: + from fudai_detail_modules.fudai_detail_room_title import ( + read_live_room_title_core, + ) + + y_pianyi_val = int(getattr(analyser, "y_pianyi", 0) or 0) + current_room_title, current_room_title_raw = read_live_room_title_core( + analyser, y_pianyi_val + ) + # 更新 analyser 的属性 + try: + analyser.current_room_title = current_room_title + analyser.current_room_title_raw = current_room_title_raw + except Exception: + pass + except Exception as e: + try: + analyser._log_kv( + "福袋详情", + "read_fudai_detail_once:直播间标题识别失败", + error=str(e), + log_type="WARNING", + ) + except Exception: + pass + content, time_text, participants, copies, prize_value_yuan = get_fudai_contain( analyser, renwu=task_count ) diff --git a/fudai_detail_modules/fudai_detail_room_title.py b/fudai_detail_modules/fudai_detail_room_title.py index fb38855..0c245a0 100644 --- a/fudai_detail_modules/fudai_detail_room_title.py +++ b/fudai_detail_modules/fudai_detail_room_title.py @@ -207,6 +207,18 @@ def read_live_room_title_core( t, r = _ocr_try_room_title(analyser, "live_room_title_mid", 0) title = t raw_text = r + + # 输出识别结果日志 + try: + analyser._log_kv( + "直播间标题", + "OCR识别直播间标题", + title=title, + raw_text=raw_text, + log_type="INFO", + ) + except Exception: + pass except Exception as e: try: analyser._log_kv(