- diagnostics/ 11 个:环境/配置/依赖诊断 - logs/ 7 个:日志分析与查看 - coords/ 6 个:坐标拾取与区域选择 - cleanup/ 3 个:代码清理工具 - adb/ 2 个:ADB / 输入法相关 - windows/ 4 个:Windows 系统修复(备份) - dev/ 9 个:开发辅助 / 运行时探测 并更新 tools/README.md 描述新结构。 删除 3 个明显的临时调试脚本 (_dump_lines.py / tmp_*.py)。 tools/ 不被业务代码 import,分组仅为人工浏览方便。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
from douyin.core.douyin_fudai import fudai_analyse
|
|
from douyin.handlers import douyin_swipe_ops
|
|
|
|
|
|
class DummyOp:
|
|
def swipe(self, device_id, sx, sy, ex, ey, duration_ms):
|
|
# minimal output
|
|
print(
|
|
f"swipe: device={device_id} from=({sx},{sy}) to=({ex},{ey}) dur={duration_ms}"
|
|
)
|
|
|
|
def click_back(self, device_id=None):
|
|
print(f"click_back called, device={device_id}")
|
|
|
|
|
|
def main():
|
|
a = fudai_analyse()
|
|
a.operation = DummyOp()
|
|
a.device_id = "DUMMY"
|
|
# use config default of 10 to simulate ten swipes
|
|
a.fudai_exit_after_misses = int(getattr(a, "fudai_exit_after_misses", 10) or 10)
|
|
print("fudai_exit_after_misses =", a.fudai_exit_after_misses)
|
|
# ensure counter starts at 0
|
|
a._consecutive_no_fudai_count = 0
|
|
|
|
for i in range(1, 11):
|
|
print(f"\n-- swipe #{i} --")
|
|
douyin_swipe_ops.swipe_up_switch_live(a)
|
|
# simulate not finding fudai -> increment counter
|
|
a._consecutive_no_fudai_count = (
|
|
int(getattr(a, "_consecutive_no_fudai_count", 0)) + 1
|
|
)
|
|
print("consecutive_no_fudai_count =", a._consecutive_no_fudai_count)
|
|
if a._consecutive_no_fudai_count >= a.fudai_exit_after_misses:
|
|
print("threshold reached, invoking back")
|
|
try:
|
|
a.operation.click_back(a.device_id)
|
|
except Exception:
|
|
print("click_back failed")
|
|
# reset counter as real logic would
|
|
a._consecutive_no_fudai_count = 0
|
|
break
|
|
else:
|
|
print("\nNo back triggered after 10 swipes")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|