Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
I
ils-common-video
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
提交
议题看板
打开侧边栏
OpsTeam
ils-common-video
Commits
05d5903a
提交
05d5903a
authored
5月 27, 2021
作者:
zw.wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: [merger] 修改事件获取的起止时间
上级
1dcc0735
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
11 行增加
和
2 行删除
+11
-2
merger.py
isc_video_record/merger.py
+11
-2
没有找到文件。
isc_video_record/merger.py
浏览文件 @
05d5903a
...
@@ -48,16 +48,23 @@ class EventMergerJob:
...
@@ -48,16 +48,23 @@ class EventMergerJob:
last_check_time
=
pipe
.
get
(
last_check_time_key
)
last_check_time
=
pipe
.
get
(
last_check_time_key
)
if
not
last_check_time
:
if
not
last_check_time
:
# 设备无上次事件,取最近的15分钟作为开始时间
# 设备无上次事件,取最近的15分钟作为开始时间
last_check_time
=
now
-
timedelta
(
minutes
=
15
)
last_check_time
=
now
-
timedelta
(
hours
=
2
)
pipe
.
set
(
last_check_time_key
,
last_check_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
))
else
:
else
:
last_check_time
=
datetime
.
strptime
(
last_check_time
=
datetime
.
strptime
(
last_check_time
,
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
last_check_time
,
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
# 调整最大事件长度为1天
if
now
-
last_check_time
>
timedelta
(
days
=
7
):
# 设备一直离线超过七天则放弃七天以前的数据
last_check_time
=
now
-
timedelta
(
days
=
7
)
if
now
-
last_check_time
>
timedelta
(
days
=
1
):
if
now
-
last_check_time
>
timedelta
(
days
=
1
):
# 时间跨度超过一天,则分割成两个小时
now
=
last_check_time
+
timedelta
(
hours
=
2
)
now
=
last_check_time
+
timedelta
(
hours
=
2
)
events
=
[]
events
=
[]
try
:
try
:
log
.
info
(
'查询摄像头
%
s在
%
s,
%
s的本地视频文件'
,
camera
[
'device_code'
],
last_check_time
,
now
)
events
=
api_helper
.
get_cameras_playback_urls
(
events
=
api_helper
.
get_cameras_playback_urls
(
camera
[
'device_code'
],
camera
[
'device_code'
],
IntelabApiHelper
.
iso_format
(
last_check_time
.
astimezone
(
tz
)),
IntelabApiHelper
.
iso_format
(
last_check_time
.
astimezone
(
tz
)),
...
@@ -163,6 +170,8 @@ class EventMergerJob:
...
@@ -163,6 +170,8 @@ class EventMergerJob:
log
.
exception
(
e
)
log
.
exception
(
e
)
send_alarm_to_developer
(
'isc-merger'
,
e
)
send_alarm_to_developer
(
'isc-merger'
,
e
)
log
.
info
(
'====================='
)
pipe
.
close
()
pipe
.
close
()
try
:
try
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论