feat: 清理旧截图文件以避免复用过期截图,并优化截图文件检查逻辑
- 在程序启动时清理旧截图文件 - 在记录映射表前清理截图文件 - 增强截图文件过期检查(30秒超时) - 避免程序启动时复用低置信度的过期截图
This commit is contained in:
1 parent
e091db7a54
commit
de2fb909a9
3 files changed
+3
No files matched your search
@@ -562,6 +562,7 @@ class fudai_analyse:
|
||||
try:
|
||||
import path_config
|
||||
import os
|
||||
|
||||
pic_path = path_config.get_screenshot_path()
|
||||
if os.path.exists(pic_path):
|
||||
os.remove(pic_path)
|
||||
|
||||
@@ -228,6 +228,7 @@ class ReservationHandler:
|
||||
try:
|
||||
import path_config
|
||||
import os
|
||||
|
||||
pic_path = path_config.get_screenshot_path()
|
||||
if os.path.exists(pic_path):
|
||||
os.remove(pic_path)
|
||||
|
||||
@@ -218,6 +218,7 @@ def read_live_room_title_core(
|
||||
if os.path.exists(pic_path) and os.path.getsize(pic_path) >= 1024:
|
||||
# 检查文件修改时间,避免复用过期的截图(超过30秒的认为过期)
|
||||
import time
|
||||
|
||||
file_mtime = os.path.getmtime(pic_path)
|
||||
current_time = time.time()
|
||||
if current_time - file_mtime > 30:
|
||||
|
||||
Reference in new issue
Block a user