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 b17c0900
authored
Dec 24, 2018
by
熊付
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
【任务空指针异常处理】
1 parent
57a2af4d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
9 deletions
code/tx1_box_serv/apps/api/task.py
code/tx1_box_serv/apps/api/task.pyc
code/tx1_box_serv/apps/api/task.py
View file @
b17c090
...
@@ -61,13 +61,18 @@ def edit_task_inf(task_index):
...
@@ -61,13 +61,18 @@ def edit_task_inf(task_index):
'''
'''
===========================更改task_name start===============
===========================更改task_name start===============
'''
'''
if
task_data
.
has_key
(
'task_name'
):
if
task_data
.
has_key
(
'
sub
task_name'
):
task_name
=
task_data
[
'task_name'
]
task_name
=
task_data
[
'
sub
task_name'
]
if
task_name
is
not
None
:
if
task_name
is
not
None
:
task_name_doc
=
editXml
.
parseXmlStr
(
tasks
[
0
]
)
task_name_doc
=
editXml
.
parseXmlStr
(
tasks
[
0
]
)
if
task_name_doc
:
if
task_name_doc
:
root
=
task_name_doc
.
documentElement
root
=
task_name_doc
.
documentElement
Name
=
root
.
getElementsByTagName
(
"Name"
)[
0
]
.
childNodes
[
0
]
Name
=
root
.
getElementsByTagName
(
"Name"
)[
0
]
if
Name
is
None
or
len
(
Name
.
childNodes
)
==
0
:
newtext
=
task_name_doc
.
createTextNode
(
task_name
)
Name
.
appendChild
(
newtext
)
else
:
Name
=
Name
.
childNodes
[
0
]
Name
.
data
=
task_name
Name
.
data
=
task_name
xml
=
task_name_doc
.
toxml
()
xml
=
task_name_doc
.
toxml
()
xml
=
xml
.
replace
(
'<?xml version="1.0" ?>'
,
'<?xml version="1.0" encoding="GBK"?>'
)
xml
=
xml
.
replace
(
'<?xml version="1.0" ?>'
,
'<?xml version="1.0" encoding="GBK"?>'
)
...
@@ -82,8 +87,16 @@ def edit_task_inf(task_index):
...
@@ -82,8 +87,16 @@ def edit_task_inf(task_index):
if
play_url
is
not
None
:
if
play_url
is
not
None
:
scenes
=
editXml
.
parseXmlStr
(
os
.
path
.
join
(
tasks
[
1
],
'scene.xml'
)
)
scenes
=
editXml
.
parseXmlStr
(
os
.
path
.
join
(
tasks
[
1
],
'scene.xml'
)
)
root
=
scenes
.
documentElement
root
=
scenes
.
documentElement
scen_play_url
=
root
.
getElementsByTagName
(
"scene1"
)[
0
]
.
getElementsByTagName
(
"play_urls"
)[
0
]
.
getElementsByTagName
(
"rtsp"
)[
0
]
.
childNodes
[
0
]
#scen_play_url = root.getElementsByTagName ( "scene1" )[0].getElementsByTagName ( "play_urls" )[0].getElementsByTagName ( "rtsp" )[0].childNodes[0]
print
scen_play_url
.
data
scen_play_url
=
\
root
.
getElementsByTagName
(
"scene1"
)[
0
]
.
getElementsByTagName
(
"play_urls"
)[
0
]
.
getElementsByTagName
(
"rtsp"
)[
0
]
print
scen_play_url
if
scen_play_url
is
None
or
len
(
scen_play_url
.
childNodes
)
==
0
:
newtext
=
scenes
.
createTextNode
(
play_url
)
scen_play_url
.
appendChild
(
newtext
)
else
:
scen_play_url
=
scen_play_url
.
childNodes
[
0
]
scen_play_url
.
data
=
play_url
scen_play_url
.
data
=
play_url
xml
=
scenes
.
toxml
()
xml
=
scenes
.
toxml
()
xml
=
xml
.
replace
(
'"'
,
'"'
)
xml
=
xml
.
replace
(
'"'
,
'"'
)
...
@@ -124,7 +137,7 @@ def edit_task_inf(task_index):
...
@@ -124,7 +137,7 @@ def edit_task_inf(task_index):
'''
'''
启动任务开始
启动任务开始
'''
'''
os
.
system
(
'pkill VAServer'
)
os
.
system
(
'pkill
-9
VAServer'
)
result_data
=
{
"ecode"
:
"200"
,
"enote"
:
"OK"
}
result_data
=
{
"ecode"
:
"200"
,
"enote"
:
"OK"
}
res
=
flask
.
make_response
(
res
=
flask
.
make_response
(
...
@@ -190,7 +203,9 @@ def read_task_name(xmlPath):
...
@@ -190,7 +203,9 @@ def read_task_name(xmlPath):
task_name_doc
=
editXml
.
parseXmlStr
(
xmlPath
)
task_name_doc
=
editXml
.
parseXmlStr
(
xmlPath
)
if
task_name_doc
:
if
task_name_doc
:
root
=
task_name_doc
.
documentElement
root
=
task_name_doc
.
documentElement
name
=
root
.
getElementsByTagName
(
"Name"
)[
0
]
.
childNodes
[
0
]
name
=
root
.
getElementsByTagName
(
"Name"
)[
0
]
if
name
is
not
None
and
len
(
name
.
childNodes
)
>
0
:
name
=
name
.
childNodes
[
0
]
print
'name =
%
s'
%
name
.
data
print
'name =
%
s'
%
name
.
data
return
name
.
data
return
name
.
data
return
''
return
''
...
@@ -199,7 +214,9 @@ def read_task_id(xmlPath):
...
@@ -199,7 +214,9 @@ def read_task_id(xmlPath):
task_id_doc
=
editXml
.
parseXmlStr
(
xmlPath
)
task_id_doc
=
editXml
.
parseXmlStr
(
xmlPath
)
if
task_id_doc
:
if
task_id_doc
:
root
=
task_id_doc
.
documentElement
root
=
task_id_doc
.
documentElement
task_id
=
root
.
getElementsByTagName
(
"task_unid"
)[
0
]
.
childNodes
[
0
]
task_id
=
root
.
getElementsByTagName
(
"task_unid"
)[
0
]
if
task_id
is
not
None
and
len
(
task_id
.
childNodes
)
>
0
:
task_id
=
task_id
.
childNodes
[
0
]
print
'task_id =
%
s'
%
task_id
.
data
print
'task_id =
%
s'
%
task_id
.
data
return
task_id
.
data
return
task_id
.
data
return
''
return
''
...
@@ -210,7 +227,9 @@ def read_rtsp(xmlPath):
...
@@ -210,7 +227,9 @@ def read_rtsp(xmlPath):
root
=
scenes
.
documentElement
root
=
scenes
.
documentElement
scen_play_url
=
\
scen_play_url
=
\
root
.
getElementsByTagName
(
"scene1"
)[
0
]
.
getElementsByTagName
(
"play_urls"
)[
0
]
.
getElementsByTagName
(
root
.
getElementsByTagName
(
"scene1"
)[
0
]
.
getElementsByTagName
(
"play_urls"
)[
0
]
.
getElementsByTagName
(
"rtsp"
)[
0
]
.
childNodes
[
0
]
"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
.
data
return
''
return
''
...
...
code/tx1_box_serv/apps/api/task.pyc
View file @
b17c090
No preview for this file type
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