Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
platform
/
tx1_box_serv
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a57e89af
authored
Jan 10, 2019
by
熊付
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
【动态读取任务相关参数】
1 parent
212e4a66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
code/tx1_box_serv/apps/api/task.py
code/tx1_box_serv/apps/api/task.py
View file @
a57e89a
...
@@ -190,13 +190,13 @@ def make_task_info(task_index):
...
@@ -190,13 +190,13 @@ def make_task_info(task_index):
taski
=
tasks
[
1
]
taski
=
tasks
[
1
]
task
.
setdefault
(
'subtask_id'
,
read_task_id
(
os
.
path
.
join
(
taski
+
'task.xml'
)))
task
.
setdefault
(
'subtask_id'
,
read_task_id
(
os
.
path
.
join
(
taski
+
'task.xml'
)))
mtask_path
=
tasks
[
2
]
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
:
if
rtsp
==
''
or
rtsp
is
None
:
task
.
setdefault
(
'is_active'
,
False
)
task
.
setdefault
(
'is_active'
,
False
)
else
:
else
:
task
.
setdefault
(
'is_active'
,
True
)
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
return
task
def
read_task_name
(
xmlPath
):
def
read_task_name
(
xmlPath
):
...
@@ -230,10 +230,21 @@ def read_rtsp(xmlPath):
...
@@ -230,10 +230,21 @@ def read_rtsp(xmlPath):
"rtsp"
)[
0
]
"rtsp"
)[
0
]
if
scen_play_url
is
not
None
and
len
(
scen_play_url
.
childNodes
)
>
0
:
if
scen_play_url
is
not
None
and
len
(
scen_play_url
.
childNodes
)
>
0
:
scen_play_url
=
scen_play_url
.
childNodes
[
0
]
scen_play_url
=
scen_play_url
.
childNodes
[
0
]
return
scen_play_url
.
data
scen_play_url
=
scen_play_url
.
data
return
''
else
:
scen_play_url
=
''
def
make_mtasks
(
cal_path
,
roi_path
,
basconpath
,
conpath
,
rtsp
):
"""
获取算法类型
"""
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
,
algo_type
):
mtasks
=
[]
mtasks
=
[]
scenes
=
[]
scenes
=
[]
cal
=
editXml
.
openXml
(
cal_path
)
cal
=
editXml
.
openXml
(
cal_path
)
...
@@ -245,7 +256,6 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp):
...
@@ -245,7 +256,6 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp):
con
=
con
.
replace
(
'
\n
'
,
''
)
con
=
con
.
replace
(
'
\n
'
,
''
)
config
=
{}
config
=
{}
config
.
setdefault
(
'xml'
,
con
)
config
.
setdefault
(
'xml'
,
con
)
play_urls
=
{}
play_urls
=
{}
play_urls
.
setdefault
(
'rtsp'
,
rtsp
)
play_urls
.
setdefault
(
'rtsp'
,
rtsp
)
...
@@ -266,7 +276,8 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp):
...
@@ -266,7 +276,8 @@ def make_mtasks(cal_path,roi_path,basconpath,conpath,rtsp):
sce
.
setdefault
(
'config'
,
config
)
sce
.
setdefault
(
'config'
,
config
)
sce
.
setdefault
(
'basicConfig'
,
basConfig
)
sce
.
setdefault
(
'basicConfig'
,
basConfig
)
sce
.
setdefault
(
'play_urls'
,
play_urls
)
sce
.
setdefault
(
'play_urls'
,
play_urls
)
sce
.
setdefault
(
'algo_type'
,
0
)
sce
.
setdefault
(
'algo_type'
,
algo_type
)
scenes
.
append
(
sce
)
scenes
.
append
(
sce
)
mtask
=
{}
mtask
=
{}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment