合并代码
This commit is contained in:
2
.idea/iOSAI.iml
generated
2
.idea/iOSAI.iml
generated
@@ -2,7 +2,7 @@
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.12" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.12 (IOS-AI)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -3,5 +3,5 @@
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.12" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (IOS-AI)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
47
.idea/workspace.xml
generated
47
.idea/workspace.xml
generated
@@ -5,7 +5,12 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="eceeff5e-51c1-459c-a911-d21ec090a423" name="Changes" comment="ai 开始测试">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/iOSAI.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/iOSAI.iml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Utils/AiUtils.py" beforeDir="false" afterPath="$PROJECT_DIR$/Utils/AiUtils.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Utils/LogManager.py" beforeDir="false" afterPath="$PROJECT_DIR$/Utils/LogManager.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/script/ScriptManager.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ScriptManager.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tidevice_entry.py" beforeDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -45,27 +50,27 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||
"Python.123.executor": "Run",
|
||||
"Python.Main.executor": "Run",
|
||||
"Python.tidevice_entry.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"javascript.nodejs.core.library.configured.version": "22.18.0",
|
||||
"javascript.nodejs.core.library.typings.version": "22.18.1",
|
||||
"last_opened_file_path": "F:/company code/AI item/20250820/iOSAI",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "com.gitee.ui.GiteeSettingsConfigurable",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||
"Python.123.executor": "Run",
|
||||
"Python.Main.executor": "Run",
|
||||
"Python.tidevice_entry.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"git-widget-placeholder": "Merging main",
|
||||
"javascript.nodejs.core.library.configured.version": "22.18.0",
|
||||
"javascript.nodejs.core.library.typings.version": "22.18.1",
|
||||
"last_opened_file_path": "F:/company code/AI item/20250820/iOSAI",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "com.gitee.ui.GiteeSettingsConfigurable",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RecentsManager">
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="E:\Code\python\iOSAI\resources" />
|
||||
|
||||
@@ -294,6 +294,7 @@ class AiUtils(object):
|
||||
print(f"btn:{btn}")
|
||||
return cls.findNumber(btn.label)
|
||||
|
||||
|
||||
@classmethod
|
||||
def extract_messages_from_xml(cls, xml: str):
|
||||
"""
|
||||
@@ -303,15 +304,6 @@ class AiUtils(object):
|
||||
root = etree.fromstring(xml.encode("utf-8"))
|
||||
items = []
|
||||
|
||||
# 判断是否是聊天页面
|
||||
is_chat_page = False
|
||||
if root.xpath('//XCUIElementTypeStaticText[contains(@traits, "Header")]'):
|
||||
is_chat_page = True
|
||||
elif root.xpath('//XCUIElementTypeCell//XCUIElementTypeOther[@name or @label]'):
|
||||
is_chat_page = True
|
||||
|
||||
if not is_chat_page:
|
||||
raise Exception("请先进入聊天页面")
|
||||
|
||||
# 屏幕宽度
|
||||
app = root.xpath('/XCUIElementTypeApplication')
|
||||
|
||||
@@ -180,9 +180,9 @@ class LogManager:
|
||||
if not log_path.exists():
|
||||
return False
|
||||
|
||||
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
filename = f"{timestamp}_logs.zip"
|
||||
|
||||
print(filename)
|
||||
zip_buf = io.BytesIO()
|
||||
with zipfile.ZipFile(zip_buf, "w", compression=zipfile.ZIP_DEFLATED) as zf:
|
||||
for p in log_path.rglob("*"):
|
||||
|
||||
@@ -8,8 +8,9 @@ import os
|
||||
from Utils.AiUtils import AiUtils
|
||||
from Utils.ControlUtils import ControlUtils
|
||||
from Utils.LogManager import LogManager
|
||||
from Entity.Variables import anchorList, removeModelFromAnchorList, prologueList, anchorWithSession
|
||||
from Entity.Variables import anchorList, removeModelFromAnchorList, anchorWithSession
|
||||
from Utils.Requester import Requester
|
||||
import Entity.Variables as ev
|
||||
|
||||
|
||||
# 脚本管理类
|
||||
@@ -313,6 +314,10 @@ class ScriptManager():
|
||||
ControlUtils.clickBack(session)
|
||||
time.sleep(2)
|
||||
|
||||
print("循环条件1", not event.is_set())
|
||||
print("循环条件2", len(anchorList) > 0)
|
||||
print("总循环条件", not event.is_set() and len(anchorList) > 0)
|
||||
|
||||
# 循环条件。1、 循环关闭 2、 数据处理完毕
|
||||
while not event.is_set() and len(anchorList) > 0:
|
||||
|
||||
@@ -452,12 +457,23 @@ class ScriptManager():
|
||||
# 查找聊天界面中的输入框节点
|
||||
chatInput = session.xpath("//TextView")
|
||||
if chatInput.exists:
|
||||
|
||||
print("找到输入框了, 准备发送一条打招呼消息")
|
||||
LogManager.method_info("找到输入框了, 准备发送一条打招呼消息", "关注打招呼", udid)
|
||||
|
||||
print("打招呼的数据", ev.prologueList)
|
||||
|
||||
# 准备打招呼的文案
|
||||
text = random.choice(prologueList)
|
||||
# 翻译成主播国家的语言
|
||||
msg = Requester.translation(text, anchorCountry)
|
||||
text = random.choice(ev.prologueList)
|
||||
|
||||
isContainChniese = AiUtils.contains_chinese(text)
|
||||
|
||||
if isContainChniese:
|
||||
# 翻译成主播国家的语言
|
||||
msg = Requester.translation(text, anchorCountry)
|
||||
else:
|
||||
msg = text
|
||||
|
||||
# 准备发送一条信息
|
||||
chatInput.click()
|
||||
time.sleep(2)
|
||||
@@ -487,8 +503,6 @@ class ScriptManager():
|
||||
print("即将要回复消息")
|
||||
LogManager.method_info("即将要回复消息", "关注打招呼", udid)
|
||||
|
||||
|
||||
|
||||
if needReply:
|
||||
print("如果需要回复主播消息。走此逻辑")
|
||||
|
||||
@@ -497,7 +511,6 @@ class ScriptManager():
|
||||
# 执行回复消息逻辑
|
||||
self.monitorMessages(session, udid)
|
||||
|
||||
|
||||
homeButton = AiUtils.findHomeButton(udid)
|
||||
if homeButton.exists:
|
||||
homeButton.click()
|
||||
|
||||
Reference in New Issue
Block a user