修复打包问题

This commit is contained in:
2025-10-23 18:53:22 +08:00
parent 2310333a60
commit 6cf4d9cb03
2188 changed files with 889511 additions and 170 deletions

View File

@@ -11,7 +11,7 @@ from pathlib import Path
import wda
import os
from ultralytics import YOLO
# from ultralytics import YOLO
from Entity import Variables
from Utils.AiUtils import AiUtils
@@ -40,8 +40,8 @@ class ScriptManager():
def __init__(self):
super().__init__()
weight_path = Path(__file__).resolve().parent.parent / "best.pt"
self.model = YOLO(weight_path) # 只传一个参数
# weight_path = Path(__file__).resolve().parent.parent / "best.pt"
# self.model = YOLO(weight_path) # 只传一个参数
self.initialized = True # 标记已初始化
@@ -206,7 +206,7 @@ class ScriptManager():
LogManager.method_info("继续观看视频", "养号", udid)
LogManager.method_info("准备划到下一个视频", "养号", udid)
client.swipe_up()
ControlUtils.swipe_up(udid)
else:
LogManager.method_error("找不到首页按钮。出错了", "养号", udid)
# else:
@@ -220,8 +220,8 @@ class ScriptManager():
# 评论
# 使用训练好的best.pt(yolo v8模型)进行识别评论区域
if random.random() > 0.70:
self.comment_flow(filePath, session, udid, recomend_cx, recomend_cy)
# if random.random() > 0.70:
# self.comment_flow(filePath, session, udid, recomend_cx, recomend_cy)
videoTime = random.randint(15, 30)
for _ in range(videoTime):
@@ -229,7 +229,7 @@ class ScriptManager():
break
event.wait(timeout=1)
session.swipe_up()
ControlUtils.swipe_up(udid)
# 如果is_monitoring 为False 则说明和监控消息没有联动,反正 则证明和监控消息进行联动
if is_monitoring:
@@ -310,7 +310,7 @@ class ScriptManager():
continue
# 下滑一下
client.swipe_up()
ControlUtils.swipe_up(udid)
# 3) 取分辨率;可选重建 session 规避句柄陈旧
size = session.window_size()
@@ -338,7 +338,7 @@ class ScriptManager():
if session(xpath='//XCUIElementTypeOther[@name="kGBLInteractionViewMatchScoreBar"]').exists:
print("✅ 当前是 PK跳过")
LogManager.method_info("✅ 当前是 PK跳过", "直播养号", udid=udid)
session.swipe_up()
ControlUtils.swipe_up(udid)
continue
# 计算直播显示窗口数量(主画面+连麦小窗)
@@ -348,7 +348,7 @@ class ScriptManager():
if count > 1:
print("❌ 多窗口(有人连麦/分屏),划走")
LogManager.method_info("❌ 多窗口(有人连麦/分屏),划走", "直播养号", udid=udid)
session.swipe_up()
ControlUtils.swipe_up(udid)
continue
else:
print("✅ 单窗口,(10%概率)开始点赞")
@@ -364,7 +364,7 @@ class ScriptManager():
or AiUtils.count_add_by_xml(session) > 1:
print("❗ 中途发生 PK/连麦,跳过")
LogManager.method_info("❗ 中途发生 PK/连麦,跳过", "直播养号", udid=udid)
session.swipe_up()
ControlUtils.swipe_up(udid)
break
x = width // 3 + random.randint(-10, 10)
y = height // 3 + random.randint(10, 20)
@@ -380,7 +380,7 @@ class ScriptManager():
break
event.wait(timeout=1)
session.swipe_up()
ControlUtils.swipe_up(udid)
# 正常退出(外部 event 触发)
break
@@ -596,10 +596,10 @@ class ScriptManager():
# 使用yolo v8模型进行评论
self.comment_flow(filePath, session, udid, 100, 100)
# self.comment_flow(filePath, session, udid, 100, 100)
if count != 0:
client.swipe_up()
ControlUtils.swipe_up(udid)
# 右滑返回
client.swipe_right()
@@ -617,7 +617,7 @@ class ScriptManager():
session.appium_settings({"snapshotMaxDepth": 25})
event.wait(timeout=0.5)
# 向上滑动
session.swipe_down()
ControlUtils.swipe_down(udid)
event.wait(timeout=2)
msgButton = AiUtils.getSendMesageButton(session)
@@ -648,7 +648,7 @@ class ScriptManager():
# 准备打招呼的文案
text = random.choice(ev.prologueList)
# text = '你好啊'
# text = "hello"
LogManager.method_info(f"取出打招呼的数据,{text}, 判断是否需要翻译:{needTranslate}", "关注打招呼",
udid)
@@ -692,7 +692,7 @@ class ScriptManager():
# cx += random.randint(-5, 5)
# cy += random.randint(-5, 5)
#
# ControlUtils.tap_mini_cluster(cx, cy, session)
# session.click(cx, cy)
#
# else:
# LogManager.method_info("没找到关注按钮", "关注打招呼", udid)
@@ -880,7 +880,7 @@ class ScriptManager():
session.appium_settings({"snapshotMaxDepth": 25})
event.wait(timeout=0.5)
# 向上滑动
session.swipe_down()
ControlUtils.swipe_down(udid)
event.wait(timeout=2)
msgButton = AiUtils.getSendMesageButton(session)