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

fix: bug

上级 b17a8799
...@@ -63,7 +63,8 @@ class EventMergerJob: ...@@ -63,7 +63,8 @@ class EventMergerJob:
if now_std - last_check_time > timedelta(days=1): if now_std - last_check_time > timedelta(days=1):
last_check_time = now_std - timedelta(days=1) last_check_time = now_std - timedelta(days=1)
res = pipe.set(last_check_time_key, now_std.strftime('%Y-%m-%d %H:%M:%S')) res = pipe.set(last_check_time_key,
now_std.astimezone(pytz.utc).strftime('%Y-%m-%d %H:%M:%S'))
if not res: if not res:
continue continue
......
...@@ -27,7 +27,6 @@ client = HikVisionClient(config.get('KEY'), config.get('SECRET'), ...@@ -27,7 +27,6 @@ client = HikVisionClient(config.get('KEY'), config.get('SECRET'),
class StreamRecorder: class StreamRecorder:
def __init__(self): def __init__(self):
log_init(__name__, False, './log')
self.queue_name = 'ISC_RECORD_JOB' self.queue_name = 'ISC_RECORD_JOB'
self.connection = rabbitmq_connect() self.connection = rabbitmq_connect()
...@@ -87,12 +86,14 @@ class StreamRecorder: ...@@ -87,12 +86,14 @@ class StreamRecorder:
self.connection.close() self.connection.close()
def process_message(self, body): def process_message(self, body):
filename = self.recorder( file_name = self.recorder(
body['camera_index'], body['camera_index'],
datetime.strptime(body['start_time'], '%Y-%m-%dT%H:%M:%S'), datetime.strptime(body['start_time'], '%Y-%m-%dT%H:%M:%S'),
datetime.strptime(body['end_time'], '%Y-%m-%dT%H:%M:%S')) datetime.strptime(body['end_time'], '%Y-%m-%dT%H:%M:%S'))
video_info = get_video_duration(filename) video_info = get_video_duration(file_name)
url = aliyun_oss.oss_upload_file('isc_record/' + filename.split('/')[-1], filename) url = ''
if file_name and os.path.isfile(file_name):
url = aliyun_oss.oss_upload_file('isc_record/' + file_name.split('/')[-1], file_name)
log.info('video_info: %s, url: %s', video_info, url) log.info('video_info: %s, url: %s', video_info, url)
return True return True
...@@ -166,5 +167,6 @@ class StreamRecorder: ...@@ -166,5 +167,6 @@ class StreamRecorder:
if __name__ == '__main__': if __name__ == '__main__':
log_init(__name__, False, '/var/log/event_rcv')
stream_recorder = StreamRecorder() stream_recorder = StreamRecorder()
stream_recorder.start() stream_recorder.start()
...@@ -31,6 +31,7 @@ setuptools.setup( ...@@ -31,6 +31,7 @@ setuptools.setup(
'redis', 'redis',
'mysql-connector', 'mysql-connector',
'retrying', 'retrying',
'oss2'
], ],
python_requires='>=3.6', python_requires='>=3.6',
) )
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论