refactor: 推送改为局域网直连设备,推送前清空画廊旧图
原走 Zectrix 公网 API + 设备 MAC,现改为直连局域网墨水屏设备(喵喵固件) 的 HTTP 接口:POST /upload 推送 PNG 触发刷屏。设备画廊按追加保存,故推送 前先 GET /images 清空旧图,避免图片越推越多、且避免 slideshow 模式轮播 到过期图。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
6
main.py
6
main.py
@@ -4,7 +4,7 @@
|
||||
入口 —— 取数据 → 渲染 → 推送到设备。
|
||||
|
||||
用法:
|
||||
python3 main.py # 渲染并推送(设备 ID 取自 .env 的 ZECTRIX_DEVICE_ID)
|
||||
python3 main.py # 渲染并推送(设备 host 取自 .env 的 EPD_HOST)
|
||||
python3 main.py --render-only # 只渲染生成图片,不推送(output/dashboard.png)
|
||||
|
||||
配置统一从同目录 .env 读取(见 .env.example),真实环境变量优先。
|
||||
@@ -29,8 +29,8 @@ def main():
|
||||
return
|
||||
|
||||
from pusher import push_image
|
||||
device_id, resp = push_image(path)
|
||||
print(f"[推送] 设备 {device_id} 成功:{resp.get('data')}")
|
||||
host, resp = push_image(path)
|
||||
print(f"[推送] 设备 {host} 成功:{resp}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user