Commit a57e89af by 熊付

【动态读取任务相关参数】

1 parent 212e4a66
......@@ -190,13 +190,13 @@ def make_task_info(task_index):
taski = tasks[1]
task.setdefault ( 'subtask_id', read_task_id ( os.path.join(taski +'task.xml' )))
mtask_path = tasks[2]
rtsp = read_rtsp ( os.path.join ( taski, 'scene.xml' ) )
rtsp,algo_type = read_rtsp ( os.path.join ( taski, 'scene.xml' ) )
if rtsp =='' or rtsp is None:
task.setdefault ( 'is_active', False)
else:
task.setdefault ( 'is_active', True )
task.setdefault('mtasks',make_mtasks(os.path.join(mtask_path,'calibration.xml'),os.path.join(mtask_path,'roi_1.xml'),tasks[3],os.path.join(mtask_path,'config.xml'), rtsp))
task.setdefault('mtasks',make_mtasks(os.path.join(mtask_path,'calibration.xml'),os.path.join(mtask_path,'roi_1.xml'),tasks[3],os.path.join(mtask_path,'config.xml'), rtsp,algo_type))
return task
def read_task_name(xmlPath):
......@@ -230,10 +230,21 @@ def read_rtsp(xmlPath):
"rtsp" )[0]
if scen_play_url is not None and len(scen_play_url.childNodes) > 0:
scen_play_url = scen_play_url.childNodes[0]
return scen_play_url.data
return ''
scen_play_url = scen_play_url.data
else:
scen_play_url = ''
"""
获取算法类型
"""
algo_type = root.getElementsByTagName ( "scene1" )[0].getElementsByTagName ( "algo_type" )[0]
if algo_type is not None and len(algo_type.childNodes) > 0:
algo_type = algo_type.childNodes[0].data
else:
algo_type = 0
return scen_play_url,algo_type
return '',0
def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp):
def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp,algo_type):
mtasks = []
scenes = []
cal = editXml.openXml( cal_path )
......@@ -245,7 +256,6 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp):
con = con.replace ( '\n', '' )
config = {}
config.setdefault('xml',con)
play_urls = {}
play_urls.setdefault('rtsp',rtsp)
......@@ -266,7 +276,8 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp):
sce.setdefault ( 'config', config )
sce.setdefault ( 'basicConfig', basConfig )
sce.setdefault ( 'play_urls', play_urls )
sce.setdefault('algo_type',0)
sce.setdefault('algo_type',algo_type)
scenes.append(sce)
mtask = {}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!