兼容性

This commit is contained in:
2025-01-13 11:33:13 +08:00
parent 92160b05ea
commit 8e558396c5
2 changed files with 9 additions and 4 deletions

View File

@ -20,9 +20,12 @@ def sync_center():
:return: 任务列表
"""
try:
from template import TEMPLATES
response = session.post(os.getenv('API_ENDPOINT') + "/sync", json={
'accessKey': os.getenv('ACCESS_KEY'),
'clientStatus': util.system.get_sys_info()
'clientStatus': util.system.get_sys_info(),
'templateList': [{'id': t.get('id', ''), 'updateTime': t.get('updateTime', '')} for t in TEMPLATES.values()]
}, timeout=10)
response.raise_for_status()
except requests.RequestException as e:
@ -59,6 +62,7 @@ def get_template_info(template_id):
logger.debug("获取模板信息结果:【%s", remote_template_info)
template = {
'id': template_id,
'updateTime': remote_template_info.get('updateTime', template_id),
'scenic_name': remote_template_info.get('scenicName', '景区'),
'name': remote_template_info.get('name', '模版'),
'video_size': '1920x1080',
@ -127,10 +131,11 @@ def report_task_start(task_info):
return None
def report_task_failed(task_info):
def report_task_failed(task_info, reason=''):
try:
response = session.post('{0}/{1}/fail'.format(os.getenv('API_ENDPOINT'), task_info.get("id")), json={
'accessKey': os.getenv('ACCESS_KEY'),
'reason': reason
}, timeout=10)
response.raise_for_status()
except requests.RequestException as e: