Files
auto_control/main.py
T
butubb 468e86f0a9 feat: 新增通用步骤任务+元素抓取,完善全部项目文档
- 新增 generic_steps 通用步骤任务(可视化步骤编辑器编排流程,支持 open_app/click/swipe/input_text/wait/loop/group)

- 新增 core/uiauto_helper.py 封装 uiautodev 元素抓取客户端

- web_server 新增元素抓取/截图/设备列表等 API

- monitor.html 新增步骤编辑器、元素抓取模态框、独立关闭逻辑

- 新增 README.md 项目总览(快速上手/架构/配置/FAQ)

- 新增 doc/ARCHITECTURE.md 架构详解、doc/DEPLOY.md 部署指南、doc/API.md 接口文档

- 修复 doc/TASK_DEV.md:移除已删除的 comment 引用,补充 generic 包,更新注册示例

- .gitignore 忽略 .claude/ 工具产物
2026-08-08 10:40:06 +08:00

44 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""抖音养号命令行入口。
直接运行:python main.py
- 单设备跑一次养号,不走 web/调度
- 任务参数默认值在 tasks/douyin/task.py 顶部,可通过环境变量 WATCH_COUNT 覆盖视频数
web 管理后台请运行:python web_server.py
清理 STF 残留占用:python scripts/cleanup.py
目录结构:
config.py — 项目根配置(STF 地址/token、adb 路径、web 端口、数据目录)
bin/adb/ — adb.exe 及依赖 dll
core/ — 核心程序(STF 客户端、adb 工具、BaseWorker 基类、任务管理器)
tasks/ — 任务定义(每个 App 一个子包,自带参数默认值,继承 BaseTask + @register_task)
templates/ — 前端页面(admin/monitor.html 单页应用)
data/ — 持久化数据(SQLite:用户/分组/任务)
scripts/ — 实用脚本
"""
import os
from core.stf_client import STFClient
from tasks import get_task_class
def run_once(serial=None, **overrides):
"""单设备跑一次养号(命令行入口,不启动 web)。
走任务框架:取 douyin_nurture 任务类 → create_worker → 直接 run(当前线程)。
overrides 可传任务参数覆盖默认值,如 run_once(watch_count=20, like_enabled=False)。
"""
stf = STFClient()
task_cls = get_task_class("douyin_nurture")
task = task_cls()
params = dict(overrides)
# 命令行友好:环境变量 WATCH_COUNT 覆盖视频数
if "WATCH_COUNT" in os.environ and "watch_count" not in params:
params["watch_count"] = int(os.environ["WATCH_COUNT"])
worker = task.create_worker(stf, serial, params)
worker.run() # 直接在当前线程跑,不起子线程
if __name__ == "__main__":
run_once()