From 13bf52f7a97aa3125064b4791e3b329089697575 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 16 Jan 2026 12:59:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8=E7=A6=8F=E8=A2=8B=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=AF=BB=E5=8F=96=E4=B8=AD=E6=B7=BB=E5=8A=A0=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=97=B4=E6=A0=87=E9=A2=98=E8=AF=86=E5=88=AB=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E5=B9=B6=E8=AE=B0=E5=BD=95=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fudai_detail_modules/fudai_detail_reader.py | 28 +++++++++++++++++++ .../fudai_detail_room_title.py | 12 ++++++++ 2 files changed, 40 insertions(+) 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(