feat: 在福袋详情读取中添加直播间标题识别功能,并记录识别日志
This commit is contained in:
1 parent
ea960a73da
commit
13bf52f7a9
2 files changed
+40
No files matched your search
@@ -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
|
||||
)
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user