提交 18c3f6ed authored 作者: zw.wang's avatar zw.wang

fix: 修复时区等问题,标记录制失败的视频

上级 45bb863b
...@@ -89,7 +89,7 @@ def get_camera_info(cursor, conn): ...@@ -89,7 +89,7 @@ def get_camera_info(cursor, conn):
from camera_info from camera_info
join camera_ai_config cac join camera_ai_config cac
on camera_info.id = cac.camera_info_id on camera_info.id = cac.camera_info_id
where biz_type is not null where biz_type is not null and is_valid = 1
order by create_time; order by create_time;
''' '''
cursor.execute(sql) cursor.execute(sql)
......
...@@ -105,7 +105,7 @@ class EventMergerJob: ...@@ -105,7 +105,7 @@ class EventMergerJob:
'camera_code': camera['device_code'], 'camera_code': camera['device_code'],
'camera_index': camera['point_index_code'], 'camera_index': camera['point_index_code'],
'db_table': camera['db_table'], 'db_table': camera['db_table'],
'event_duration': event_duration + 10 'ex': event_duration + 10
} }
if len(events) > 0: if len(events) > 0:
self.send_mq_message(body) self.send_mq_message(body)
......
...@@ -125,7 +125,12 @@ class StreamRecorder: ...@@ -125,7 +125,12 @@ class StreamRecorder:
def recording(self, thread_id, db_table, event): def recording(self, thread_id, db_table, event):
t1 = time.time() t1 = time.time()
record_result = self.recorder(event['camera_code'], event['start_time'], event['end_time'], thread_id) record_result = self.recorder(
event['camera_code'],
event['start_time'].astimezone(tz), # 录制调用接口的过程中使用的是上海时区
event['end_time'].astimezone(tz),
thread_id
)
t2 = time.time() t2 = time.time()
video_info, error_log = get_video_duration(record_result['file_name']) video_info, error_log = get_video_duration(record_result['file_name'])
...@@ -143,6 +148,9 @@ class StreamRecorder: ...@@ -143,6 +148,9 @@ class StreamRecorder:
file_name=file_name, video_url=url, video_resolution=video_info['resolution'], file_name=file_name, video_url=url, video_resolution=video_info['resolution'],
recovered_time=record_result['recovered_time'].astimezone(pytz.utc)) recovered_time=record_result['recovered_time'].astimezone(pytz.utc))
os.remove(record_result['file_name']) os.remove(record_result['file_name'])
else:
# 无有效视频文件,标记事件状态 status = 2
mysql.update_video_info(db_table, event['video_id'], 2)
log.info('video_info: %s, url: %s, video_id: %s.%s, time: %s', log.info('video_info: %s, url: %s, video_id: %s.%s, time: %s',
video_info, url, db_table, video_info, url, db_table,
......
...@@ -21,7 +21,7 @@ requires = [ ...@@ -21,7 +21,7 @@ requires = [
setuptools.setup( setuptools.setup(
name='isc-video-record', name='isc-video-record',
version='1.0.0a2', version='1.0.0a5',
description='ISC motion detection playback video stream recording service.', description='ISC motion detection playback video stream recording service.',
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论