Files
douyin_guaji-main/douyin_swipe_ops.py
T
Your Name 836a31d817 refactor: Remove outdated files and enhance Web GUI functionality
- Deleted obsolete markdown files related to follow tab coordinates testing and results.
- Removed outdated batch scripts for launching the Web GUI.
- Updated `config.json` to improve reservation handling and adjust prize value settings.
- Enhanced logging and error handling in `web_gui.py` and `app.js` for better user experience.
- Added automatic screenshot functionality during Web GUI startup for improved monitoring.
2025-12-19 03:31:08 +08:00

54 lines
1.5 KiB
Python

from __future__ import annotations
from typing import Any
def swipe_up_switch_live(analyser: Any) -> None:
"""上滑切换到下一个直播间(基础版封装)。
采用 1080x2400 基准坐标,在屏幕中下部向上滑一段距离。
"""
try:
rx = int(getattr(analyser, "resolution_ratio_x", 1080) or 1080)
except Exception:
rx = 1080
try:
ry = int(getattr(analyser, "resolution_ratio_y", 2400) or 2400)
except Exception:
ry = 2400
device_id = getattr(analyser, "device_id", "")
# 基准坐标(1080x2400):从中下部往上滑
start_x_base = 540
start_y_base = 1700
end_x_base = 540
end_y_base = 700
start_x = start_x_base * rx // 1080
end_x = end_x_base * rx // 1080
start_y = start_y_base * ry // 2400
end_y = end_y_base * ry // 2400
try:
analyser._log_kv(
"滑动",
"swipe_up_switch_live:上滑切换直播间",
start_x=start_x_base,
start_y=start_y_base,
end_x=end_x_base,
end_y=end_y_base,
)
except Exception:
pass
# 优先调用底层 swipe,失败则静默忽略(不影响主流程)
try:
analyser.operation.swipe(device_id, start_x, start_y, end_x, end_y, 300)
except Exception:
try:
# 如果 analyser 自身提供 swipe 封装,则退回到该封装
analyser.swipe(start_x_base, start_y_base, end_x_base, end_y_base, 300)
except Exception:
pass