兼容性
This commit is contained in:
parent
92160b05ea
commit
8e558396c5
@ -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:
|
||||
|
@ -12,7 +12,7 @@ def to_annexb(file):
|
||||
if not os.path.exists(file):
|
||||
return file
|
||||
logger.info("ToAnnexb: %s", file)
|
||||
ffmpeg_process = subprocess.run(["ffmpeg.exe", "-y", "-hide_banner", "-i", file, "-c", "copy", "-bsf:v", "h264_mp4toannexb",
|
||||
ffmpeg_process = subprocess.run(["ffmpeg", "-y", "-hide_banner", "-i", file, "-c", "copy", "-bsf:v", "h264_mp4toannexb",
|
||||
"-f", "mpegts", file+".ts"])
|
||||
logger.info("ToAnnexb: %s, returned: %s", file, ffmpeg_process.returncode)
|
||||
if ffmpeg_process.returncode == 0:
|
||||
@ -31,7 +31,7 @@ def start_render(ffmpeg_task: FfmpegTask):
|
||||
if len(ffmpeg_args) == 0:
|
||||
ffmpeg_task.set_output_file(ffmpeg_task.input_file[0])
|
||||
return True
|
||||
ffmpeg_process = subprocess.run(["ffmpeg.exe", "-progress", "-", "-loglevel", "error", *ffmpeg_args], **subprocess_args(True))
|
||||
ffmpeg_process = subprocess.run(["ffmpeg", "-progress", "-", "-loglevel", "error", *ffmpeg_args], **subprocess_args(True))
|
||||
logger.info("FINISH TASK, OUTPUT IS %s", handle_ffmpeg_output(ffmpeg_process.stdout))
|
||||
code = ffmpeg_process.returncode
|
||||
return code == 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user