diff --git a/.idea/iOSAI.iml b/.idea/iOSAI.iml index df5cbff..f571432 100644 --- a/.idea/iOSAI.iml +++ b/.idea/iOSAI.iml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index c27b771..db8786c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c43bfc4..c487aa4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,13 +5,11 @@ + + - - - - - + - { - "keyToString": { - "ASKED_ADD_EXTERNAL_FILES": "true", - "Python.123 (1).executor": "Run", - "Python.123.executor": "Run", - "Python.FlaskService.executor": "Run", - "Python.LogManager.executor": "Run", - "Python.Main.executor": "Run", - "Python.ScriptManager.executor": "Run", - "RunOnceActivity.ShowReadmeOnStart": "true", - "SHARE_PROJECT_CONFIGURATION_FILES": "true", - "git-widget-placeholder": "main", - "javascript.nodejs.core.library.configured.version": "20.17.0", - "javascript.nodejs.core.library.typings.version": "20.17.58", - "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" + +}]]> - - - - - - - - - - - - - + - - - - - - - - - - - - @@ -274,11 +146,11 @@ - - - - - + + + + + - - - @@ -311,12 +175,10 @@ - - - - - - - + + + + + \ No newline at end of file diff --git a/Entity/Variables.py b/Entity/Variables.py index 6592343..bbab908 100644 --- a/Entity/Variables.py +++ b/Entity/Variables.py @@ -4,6 +4,7 @@ from Entity.AnchorModel import AnchorModel # wda apple bundle id WdaAppBundleId = "com.yolozsAgent.wda.xctrunner" + # 全局主播列表 anchorList: list[AnchorModel] = [] # 线程锁 diff --git a/build-tidevice.bat b/build-tidevice.bat new file mode 100644 index 0000000..cb175bb --- /dev/null +++ b/build-tidevice.bat @@ -0,0 +1,9 @@ +pyinstaller -F -n tidevice ^ + --hidden-import=tidevice._proto ^ + --hidden-import=tidevice._instruments ^ + --hidden-import=tidevice._usbmux ^ + --hidden-import=tidevice._wdaproxy ^ + --collect-all tidevice ^ + -c ^ + --add-data="C:\Users\milk\AppData\Local\Programs\Python\Python312\Lib\site-packages\tidevice;tidevice" ^ + tidevice_entry.py \ No newline at end of file diff --git a/build.bat b/build.bat index 98699cd..2bdf314 100644 --- a/build.bat +++ b/build.bat @@ -1,11 +1,17 @@ -python -m nuitka Module/Main.py ^ +@echo off +python -m nuitka Module\Main.py ^ --standalone ^ --msvc=latest ^ --windows-console-mode=disable ^ --remove-output ^ --output-dir=out ^ --output-filename=IOSAI ^ - --include-package=Module,Utils,Entity,script ^ + --include-package=Module,Utils,Entity,script,tidevice ^ + --include-module=tidevice.__main__ ^ + --include-module=tidevice._proto ^ + --include-module=tidevice._instruments ^ + --include-module=tidevice._usbmux ^ + --include-module=tidevice._wdaproxy ^ --include-module=flask ^ --include-module=flask_cors ^ --include-module=jinja2 ^ @@ -21,4 +27,5 @@ python -m nuitka Module/Main.py ^ --include-data-dir="E:/Code/python/iOSAI/SupportFiles=SupportFiles" ^ --include-data-dir="E:/Code/python/iOSAI/resources=resources" ^ --include-data-files="E:/Code/python/iOSAI/resources/iproxy/*=resources/iproxy/" ^ - --windows-icon-from-ico=resources/icon.ico \ No newline at end of file + --windows-icon-from-ico=resources/icon.ico +pause \ No newline at end of file diff --git a/resources/iproxy/tidevice.exe b/resources/iproxy/tidevice.exe new file mode 100644 index 0000000..466c364 Binary files /dev/null and b/resources/iproxy/tidevice.exe differ diff --git a/script/mac_wda_agent.py b/script/mac_wda_agent.py new file mode 100644 index 0000000..074ed53 --- /dev/null +++ b/script/mac_wda_agent.py @@ -0,0 +1,38 @@ +# windows_run.py(替换你起 iproxy 的那几行) +import os, subprocess, time, requests, wda +from pathlib import Path + +UDID = "00008110-00067D0014D3B01E" +MAC = "http://192.168.1.219:8765" + +# 让 Mac 起 WDA(不转发) +requests.post(f"{MAC}/startWDA", json={"udid": UDID}, timeout=600).raise_for_status() + +# 计算 iproxy 绝对路径(项目根/resources/iproxy/iproxy.exe) +BASE = Path(__file__).resolve().parents[1] # iOSAI/ +IPROXY = BASE / "resources" / "iproxy" / "iproxy.exe" +if not IPROXY.exists(): + raise FileNotFoundError(f"iproxy 不在这里: {IPROXY}") + +# 可选:把 iproxy 目录加入 PATH,避免 DLL 依赖找不到 +env = os.environ.copy() +env["PATH"] = str(IPROXY.parent) + os.pathsep + env.get("PATH", "") +try: + os.add_dll_directory(str(IPROXY.parent)) # 仅 Windows 有效 +except Exception: + pass + +# 起 iproxy:本地 9111 -> 设备 8100 +p = subprocess.Popen([str(IPROXY), "-u", UDID, "9111", "8100"], + cwd=str(IPROXY.parent), + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + text=True, creationflags=0x08000000) + +# 探活 WDA +c = wda.Client("http://127.0.0.1:9111") + +for _ in range(120): + try: + print(c.status()); break + except: + time.sleep(1) diff --git a/script/windows_run.py b/script/windows_run.py new file mode 100644 index 0000000..1ba8361 --- /dev/null +++ b/script/windows_run.py @@ -0,0 +1,35 @@ +from pathlib import Path +import os, subprocess, time, requests, wda + +UDID = "00008110-00067D0014D3B01E" +MAC = "http://192.168.1.90:8765" + +# 让 Mac 起 WDA +requests.post(f"{MAC}/startWDA", json={"udid": UDID}, timeout=600).raise_for_status() + +# 计算 iproxy 绝对路径:项目根/resources/iproxy/iproxy.exe +BASE = Path(__file__).resolve().parents[1] # iOSAI/ +IPROXY = BASE / "resources" / "iproxy" / "iproxy.exe" +if not IPROXY.exists(): + raise FileNotFoundError(f"iproxy 不在这里:{IPROXY}") + +# 避免 DLL 找不到:把目录加入 PATH(以及 Windows 的 DLL 搜索路径) +env = os.environ.copy() +env["PATH"] = str(IPROXY.parent) + os.pathsep + env.get("PATH", "") +try: + os.add_dll_directory(str(IPROXY.parent)) +except Exception: + pass + +# 起 iproxy:本地 9111 -> 设备 8100 +p = subprocess.Popen([str(IPROXY), "-u", UDID, "9111", "8100"], + cwd=str(IPROXY.parent), + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) + +# 探活 WDA +c = wda.Client("http://127.0.0.1:9111") +for _ in range(120): + try: + print(c.status()); break + except Exception: + time.sleep(1) diff --git a/tidevice_entry.py b/tidevice_entry.py new file mode 100644 index 0000000..b9a92b6 --- /dev/null +++ b/tidevice_entry.py @@ -0,0 +1,4 @@ +# tidevice_entry.py +from tidevice.__main__ import main +if __name__ == '__main__': + main() \ No newline at end of file