Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
E
evsuits
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
OpsTeam
evsuits
Commits
d2ec972a
提交
d2ec972a
authored
9月 25, 2019
作者:
blu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
upload video files
上级
4804a999
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
13 行增加
和
11 行删除
+13
-11
evslicer.cpp
opencv-motion-detect/evslicer.cpp
+10
-8
postfile.cpp
opencv-motion-detect/postfile.cpp
+3
-3
没有找到文件。
opencv-motion-detect/evslicer.cpp
浏览文件 @
d2ec972a
...
@@ -529,7 +529,7 @@ protected:
...
@@ -529,7 +529,7 @@ protected:
for
(
const
auto
&
entry
:
fs
::
directory_iterator
(
path
))
{
for
(
const
auto
&
entry
:
fs
::
directory_iterator
(
path
))
{
fname
=
entry
.
path
().
c_str
();
fname
=
entry
.
path
().
c_str
();
if
(
entry
.
file_size
()
==
0
||
!
entry
.
is_regular_file
()
||
entry
.
path
().
extension
()
!=
".mp4"
)
{
if
(
entry
.
file_size
()
==
0
||
!
entry
.
is_regular_file
()
||
entry
.
path
().
extension
()
!=
".mp4"
)
{
spdlog
::
warn
(
"
LoasdVideoFiles skipped {} (empty/directory/!mp4)"
,
entry
.
path
().
c_str
());
spdlog
::
warn
(
"
evslicer {} LoasdVideoFiles skipped {} (empty/directory/!mp4)"
,
selfId
,
entry
.
path
().
c_str
());
continue
;
continue
;
}
}
...
@@ -557,7 +557,7 @@ protected:
...
@@ -557,7 +557,7 @@ protected:
list
<
long
>
olds
;
list
<
long
>
olds
;
int
delta
=
maxSlices
-
tsRing
.
size
();
int
delta
=
maxSlices
-
tsRing
.
size
();
int
skip
=
delta
<
0
?
(
-
delta
)
:
0
;
int
skip
=
delta
<
0
?
(
-
delta
)
:
0
;
spdlog
::
info
(
"
LoasdVideoFiles max: {}, current: {}, skip: {}"
,
maxSlices
,
tsRing
.
size
(),
skip
);
spdlog
::
info
(
"
evslicer {} LoasdVideoFiles max: {}, current: {}, skip: {}"
,
selfId
,
maxSlices
,
tsRing
.
size
(),
skip
);
int
idx
=
0
;
int
idx
=
0
;
list
<
long
>::
iterator
pos
=
tsRing
.
begin
();
list
<
long
>::
iterator
pos
=
tsRing
.
begin
();
for
(
auto
&
i
:
tsRing
)
{
for
(
auto
&
i
:
tsRing
)
{
...
@@ -652,7 +652,7 @@ protected:
...
@@ -652,7 +652,7 @@ protected:
}
}
for
(
int
i
=
0
;
i
<
numSlices
;
i
++
){
for
(
int
i
=
0
;
i
<
numSlices
;
i
++
){
spdlog
::
info
(
"
vector[{}] = {}"
,
i
,
vTsActive
[
i
]);
spdlog
::
info
(
"
evslicer {} vector[{}] = {}"
,
selfId
,
i
,
vTsActive
[
i
]);
if
(
vTsActive
[
i
]
==
0
)
{
if
(
vTsActive
[
i
]
==
0
)
{
break
;
break
;
}
}
...
@@ -689,14 +689,15 @@ protected:
...
@@ -689,14 +689,15 @@ protected:
if
(
idxS
>
idxE
)
{
if
(
idxS
>
idxE
)
{
idxE
+=
numSlices
;
idxE
+=
numSlices
;
}
}
string
sf
;
for
(
int
i
=
idxS
;
i
<=
idxE
;
i
++
){
for
(
int
i
=
idxS
;
i
<=
idxE
;
i
++
){
int
idx
=
segToIdx
(
i
);
int
idx
=
segToIdx
(
i
);
long
ts
=
vTsActive
[
idx
];
long
ts
=
vTsActive
[
idx
];
string
fname
=
videoFileTs2Name
(
ts
);
string
fname
=
videoFileTs2Name
(
ts
);
s
pdlog
::
info
(
"file to upload: {}, {}, {}"
,
fname
,
ts
,
idx
)
;
s
f
+=
"
\t
"
+
fname
+
", "
+
to_string
(
ts
)
+
", "
+
to_string
(
idx
)
+
"
\n
"
;
ret
.
push_back
(
fname
);
ret
.
push_back
(
fname
);
}
}
spdlog
::
info
(
"evslicer {} event {} - {} files to upload: {}"
,
selfId
,
videoFileTs2Name
(
tss
),
videoFileTs2Name
(
tse
),
sf
);
}
}
}
}
...
@@ -801,13 +802,14 @@ public:
...
@@ -801,13 +802,14 @@ public:
vector
<
string
>
fileNames
;
vector
<
string
>
fileNames
;
for
(
auto
&
i
:
v
)
{
for
(
auto
&
i
:
v
)
{
string
fname
=
this
->
urlOut
+
"/"
+
i
+
".mp4"
;
string
fname
=
this
->
urlOut
+
"/"
+
i
+
".mp4"
;
spdlog
::
info
(
"prepare uploading {}"
,
fname
);
fileNames
.
push_back
(
fname
);
fileNames
.
push_back
(
fname
);
}
}
spdlog
::
info
(
"
url: {}"
,
this
->
videoFileServerApi
);
spdlog
::
info
(
"
evslicer {} file upload url: {}"
,
selfId
,
this
->
videoFileServerApi
);
// TODO: check result and reschedule it
// TODO: check result and reschedule it
netutils
::
postFiles
(
std
::
move
(
this
->
videoFileServerApi
),
std
::
move
(
params
),
std
::
move
(
fileNames
));
if
(
netutils
::
postFiles
(
std
::
move
(
this
->
videoFileServerApi
),
std
::
move
(
params
),
std
::
move
(
fileNames
))
!=
0
){
spdlog
::
error
(
"evslicer {} failed to upload files"
,
selfId
);
}
}
}
}
else
{
}
else
{
spdlog
::
error
(
"evslicer {} unkown event :{}"
,
this
->
selfId
,
evt
);
spdlog
::
error
(
"evslicer {} unkown event :{}"
,
this
->
selfId
,
evt
);
...
...
opencv-motion-detect/postfile.cpp
浏览文件 @
d2ec972a
...
@@ -31,7 +31,7 @@ int postFiles(string &&url, vector<tuple<string, string> > &¶ms, vector<stri
...
@@ -31,7 +31,7 @@ int postFiles(string &&url, vector<tuple<string, string> > &¶ms, vector<stri
field
=
curl_mime_addpart
(
form
);
field
=
curl_mime_addpart
(
form
);
curl_mime_name
(
field
,
"files[]"
);
curl_mime_name
(
field
,
"files[]"
);
curl_mime_filedata
(
field
,
f
.
c_str
());
curl_mime_filedata
(
field
,
f
.
c_str
());
spdlog
::
info
(
"curl file: {}"
,
f
);
spdlog
::
debug
(
"curl file: {}"
,
f
);
}
}
string
queryString
;
string
queryString
;
...
@@ -41,10 +41,10 @@ int postFiles(string &&url, vector<tuple<string, string> > &¶ms, vector<stri
...
@@ -41,10 +41,10 @@ int postFiles(string &&url, vector<tuple<string, string> > &¶ms, vector<stri
cnt
++
;
cnt
++
;
}
}
spdlog
::
info
(
"url is: {}, {}"
,
url
,
url
.
c_str
());
spdlog
::
debug
(
"url is: {}, {}"
,
url
,
url
.
c_str
());
string
_url
=
url
+
string
(
"?"
)
+
queryString
;
string
_url
=
url
+
string
(
"?"
)
+
queryString
;
spdlog
::
info
(
"_url: {}"
,
_url
);
spdlog
::
debug
(
"_url: {}"
,
_url
);
/* what URL that receives this POST */
/* what URL that receives this POST */
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
_url
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
_url
.
c_str
());
//curl_easy_setopt(curl, CURLOPT_POSTFIELDS, queryString.c_str());
//curl_easy_setopt(curl, CURLOPT_POSTFIELDS, queryString.c_str());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论