Commit b0d35808 by 刘航

[chg]去掉了pkill,修改roi、参数、视频源后,不需要再调用pkill让VAServer重启了。当前VAServer支持监控文件变化,做出响应。

[chg]保存数据,适配了一些json不标准的情况,让程序不会报错。
1 parent fd81e3a9
...@@ -137,7 +137,7 @@ def edit_task_inf(task_index): ...@@ -137,7 +137,7 @@ def edit_task_inf(task_index):
''' '''
启动任务开始 启动任务开始
''' '''
os.system('pkill -9 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 (
......
...@@ -48,7 +48,12 @@ class EventToLocalUtil(object): ...@@ -48,7 +48,12 @@ class EventToLocalUtil(object):
picPath = '' picPath = ''
if 'ofilename' in pic: if 'ofilename' in pic:
if index == 0: if index == 0:
infoPath = (pic['ofilename'].split('.'))[0] for s in (pic['ofilename'].split('.'))[0:-1]:
if len(infoPath) >0:
infoPath = infoPath+ '.' + s
else:
infoPath = s
# infoPath = (pic['ofilename'].split('.'))[0]
# infoPath = pic['ofilename'] # infoPath = pic['ofilename']
picPath = basePath + '/' + pic['ofilename'] picPath = basePath + '/' + pic['ofilename']
elif 'event_refid' in dataDict: elif 'event_refid' in dataDict:
...@@ -63,7 +68,7 @@ class EventToLocalUtil(object): ...@@ -63,7 +68,7 @@ class EventToLocalUtil(object):
if(len(picPath) >0): if(len(picPath) >0):
if 'pic_base64' in pic: if 'pic_base64' in pic:
try: try:
picPath= picPath.decode('utf8').encode('gb2312') picPath= picPath.decode('utf8').encode('gb2312')
with open(picPath, 'wb') as f: with open(picPath, 'wb') as f:
f.write(base64.b64decode(pic['pic_base64'])) f.write(base64.b64decode(pic['pic_base64']))
outPicsPath.append(picPath) outPicsPath.append(picPath)
...@@ -88,7 +93,7 @@ class EventToLocalUtil(object): ...@@ -88,7 +93,7 @@ class EventToLocalUtil(object):
infoPath = basePath + '/' + infoPath + '.json' infoPath = basePath + '/' + infoPath + '.json'
try: try:
infoPath = infoPath.decode('utf8').encode('gb2312') infoPath = infoPath.decode('utf8').encode('gb2312')
with open(infoPath, 'w') as f: with open(infoPath, 'w') as f:
json.dump(dataDict, f) json.dump(dataDict, f)
outInfoPath.append(infoPath) outInfoPath.append(infoPath)
...@@ -118,15 +123,20 @@ class EventToLocalUtil(object): ...@@ -118,15 +123,20 @@ class EventToLocalUtil(object):
#判断逻辑,生成路径均在此函数中实现 #判断逻辑,生成路径均在此函数中实现
def generatePath(self, dataDict): def generatePath(self, dataDict):
et = datetime.datetime.now() et = datetime.datetime.now()
if 'event_dt' in dataDict: if 'event_dt' in dataDict and len(dataDict['event_dt']) > 0:
if 'T' in dataDict['event_dt']: try:
et = datetime.datetime.strptime(dataDict['event_dt'], "%Y-%m-%dT%H:%M:%S.%f") if 'T' in dataDict['event_dt']:
et = self.utc2local(et) et = datetime.datetime.strptime(dataDict['event_dt'], "%Y-%m-%dT%H:%M:%S.%f")
pass et = self.utc2local(et)
else: pass
et = datetime.datetime.strptime(dataDict['event_dt'], "%Y-%m-%d %H:%M:%S.%f") else:
et = self.utc2local(et) et = datetime.datetime.strptime(dataDict['event_dt'], "%Y-%m-%d %H:%M:%S.%f")
pass et = self.utc2local(et)
pass
except ValueError as ve:
self.__loginfo('generatePath event_dt format error, use current time. ')
self.__loginfo(ve)
else: else:
self.__loginfo('generatePath cannot find event_dt, use current time') self.__loginfo('generatePath cannot find event_dt, use current time')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!