safesight/control/scripts/fix-use-date-prefix.py
tian 98e375dc36 chore: 合并 safesight-control 仓库为 control/ 子目录
项目合并为单仓库:设备端(根) + 管理端(control/)。
两端 git 历史完整保留(git subtree 合并)。

git-subtree-dir: control
git-subtree-mainline: 923ab10d5c
git-subtree-split: 70738edb31
2026-08-02 11:13:26 +08:00

18 lines
610 B
Python

import sqlite3, json
c = sqlite3.connect('/opt/safesightd/data/app.db')
row = c.execute("SELECT body_json FROM templates WHERE name='workshop_face_recognition_shoe_alarm'").fetchone()
body = json.loads(row[0])
for n in body['template']['nodes']:
if n.get('type') == 'alarm':
for key in ['snapshot', 'clip']:
if key in n.get('actions', {}):
n['actions'][key]['use_date_prefix'] = False
c.execute("UPDATE templates SET body_json=? WHERE name=?",
(json.dumps(body, ensure_ascii=False), 'workshop_face_recognition_shoe_alarm'))
c.commit()
c.close()
print('OK')