Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mirrorSimulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李远洪
mirrorSimulator
Commits
126a8112
Commit
126a8112
authored
Feb 04, 2021
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了视频列表上传功能
parent
8429be0b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
5 deletions
+63
-5
ui/HomeArea.py
ui/HomeArea.py
+63
-5
No files found.
ui/HomeArea.py
View file @
126a8112
#coding: utf-8
import
hashlib
import
json
import
os
import
sys
import
threading
import
time
...
...
@@ -241,7 +242,7 @@ class HomeArea():
elif
msgType
==
"4"
:
# 图片抓拍
self
.
processPicCap
(
msgJson
,
replyMsg
)
elif
msgType
==
"5"
:
# 视频回看
pass
self
.
processSeeHistoryVideo
(
msgJson
,
replyMsg
)
elif
msgType
==
"7"
:
# 紧急救援
pass
####################################################
...
...
@@ -337,6 +338,21 @@ class HomeArea():
replyMsg
=
json
.
dumps
(
replyMsg
)
globalParams
.
camera_3
.
picCapture
(
cam
,
replyMsg
,
self
.
ws
)
####################################################
# 处理视频回看
####################################################
def
processSeeHistoryVideo
(
self
,
msgJson
,
replyMsg
):
cam
=
msgJson
[
"data"
][
"cam"
]
fiList
=
self
.
getFileList
(
cam
)
replyMsg
[
"code"
]
=
"0"
replyMsg
[
"type"
]
=
"5"
replyMsg
[
"data"
]
=
fiList
replyMsg
=
json
.
dumps
(
replyMsg
)
self
.
ws
.
sendMsg
(
replyMsg
)
curTime
=
self
.
getCurTime
()
self
.
logTextCtr
.
WriteText
(
curTime
+
"回复消息:"
+
replyMsg
+
"
\n
"
)
####################################################
# 日志重定向到日志框
####################################################
...
...
@@ -348,9 +364,51 @@ class HomeArea():
####################################################
# 获取视频文件列表
####################################################
def
getFileList
(
self
):
pass
def
getFileList
(
self
,
cam
):
dirPath
=
"D:/project/python/mirrorSimulator/"
dirPath
=
dirPath
+
"SDCard/video/CAM_"
+
str
(
cam
)
+
"/"
fileList
=
{}
fileList
[
"cam"
]
=
str
(
cam
)
fileList
[
"files"
]
=
[]
file_names
=
os
.
listdir
(
dirPath
)
for
fn
in
file_names
:
fileInfo
=
{}
timeLen
=
12
fsize
=
os
.
path
.
getsize
(
dirPath
+
fn
)
fsize
=
int
(
fsize
/
1024
)
fiSplit
=
fn
.
split
(
"_"
)
fTime
=
fiSplit
[
3
]
+
"-"
+
fiSplit
[
4
][:
-
4
]
fTime
=
fTime
[:
4
]
+
"-"
+
fTime
[
4
:
6
]
+
"-"
+
fTime
[
6
:
8
]
+
" "
+
fTime
[
9
:
11
]
+
":"
+
fTime
[
11
:
13
]
+
":"
+
fTime
[
13
:]
timeArray
=
time
.
strptime
(
fTime
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
timeStamp
=
int
(
time
.
mktime
(
timeArray
))
fileInfo
[
"fname"
]
=
fn
fileInfo
[
"fsize"
]
=
str
(
fsize
)
fileInfo
[
"ftime"
]
=
timeLen
fileInfo
[
"fdate"
]
=
timeStamp
fileInfo
[
"fileaddress"
]
=
dirPath
+
fn
fileList
[
"files"
]
.
append
(
fileInfo
)
return
fileList
if
__name__
==
"__main__"
:
dirPath
=
"D:/project/python/mirrorSimulator/"
dirPath
=
dirPath
+
"SDCard/video/CAM_1/"
fileList
=
{}
fileList
[
"cam"
]
=
1
fileList
[
"files"
]
=
[]
file_names
=
os
.
listdir
(
dirPath
)
for
fn
in
file_names
:
fileInfo
=
{}
timeLen
=
12
fsize
=
os
.
path
.
getsize
(
dirPath
+
fn
)
fsize
=
int
(
fsize
/
1024
)
fiSplit
=
fn
.
split
(
"_"
)
fTime
=
fiSplit
[
3
]
+
"-"
+
fiSplit
[
4
][:
-
4
]
fileInfo
[
"fname"
]
=
fn
fileInfo
[
"fsize"
]
=
fsize
fileInfo
[
"ftime"
]
=
timeLen
fileInfo
[
"fdate"
]
=
fTime
fileList
[
"files"
]
.
append
(
fileInfo
)
print
(
fileList
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment