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
f73d499d
Commit
f73d499d
authored
Feb 02, 2021
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了文件文件手动上传视频文件功能
parent
b60558c2
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
130 additions
and
7 deletions
+130
-7
SDCard/picture/2021年02月01日--17时49分13秒_202__2.jpg
SDCard/picture/2021年02月01日--17时49分13秒_202__2.jpg
+0
-0
SDCard/picture/CAM_1/2021年02月01日--17时47分33秒_202__82.jpg
SDCard/picture/CAM_1/2021年02月01日--17时47分33秒_202__82.jpg
+0
-0
SDCard/picture/CAM_2/2021年02月01日--17时36分51秒_202__2.jpg
SDCard/picture/CAM_2/2021年02月01日--17时36分51秒_202__2.jpg
+0
-0
SDCard/picture/CAM_3/2021年02月01日--17时37分09秒_202__10.jpg
SDCard/picture/CAM_3/2021年02月01日--17时37分09秒_202__10.jpg
+0
-0
SDCard/video/CAM_1/2021年02月01日--17时37分29秒_202__18.mp4
SDCard/video/CAM_1/2021年02月01日--17时37分29秒_202__18.mp4
+0
-0
SDCard/video/CAM_2/2021年02月01日--17时36分56秒_202__9.mp4
SDCard/video/CAM_2/2021年02月01日--17时36分56秒_202__9.mp4
+0
-0
SDCard/video/CAM_3/2021年02月01日--17时37分04秒_202__4.mp4
SDCard/video/CAM_3/2021年02月01日--17时37分04秒_202__4.mp4
+0
-0
start.pyw
start.pyw
+1
-1
ui/CameraArea.py
ui/CameraArea.py
+17
-3
ui/EventAndOtherArea.py
ui/EventAndOtherArea.py
+105
-2
ui/HomeArea.py
ui/HomeArea.py
+6
-0
ui/MainWindow.py
ui/MainWindow.py
+1
-1
No files found.
SDCard/picture/2021年02月01日--17时49分13秒_202__2.jpg
0 → 100644
View file @
f73d499d
9.34 KB
SDCard/picture/CAM_1/2021年02月01日--17时47分33秒_202__82.jpg
0 → 100644
View file @
f73d499d
10.3 KB
SDCard/picture/CAM_2/2021年02月01日--17时36分51秒_202__2.jpg
0 → 100644
View file @
f73d499d
9.34 KB
SDCard/picture/CAM_3/2021年02月01日--17时37分09秒_202__10.jpg
0 → 100644
View file @
f73d499d
10.3 KB
SDCard/video/CAM_1/2021年02月01日--17时37分29秒_202__18.mp4
0 → 100644
View file @
f73d499d
File added
SDCard/video/CAM_2/2021年02月01日--17时36分56秒_202__9.mp4
0 → 100644
View file @
f73d499d
File added
SDCard/video/CAM_3/2021年02月01日--17时37分04秒_202__4.mp4
0 → 100644
View file @
f73d499d
File added
start.pyw
View file @
f73d499d
...
...
@@ -6,4 +6,4 @@ from ui import globalParams
if
__name__
==
"__main__"
:
globalParams
.
scriptPath
=
os
.
getcwd
()
MainWindow
()
.
show
()
\ No newline at end of file
MainWindow
()
.
show
()
ui/CameraArea.py
View file @
f73d499d
...
...
@@ -616,12 +616,19 @@ class CameraArea():
else
:
capTime
=
self
.
pushObj
.
getTimeStamp
()
capTime
=
int
(
capTime
/
1000
)
capdur
=
5
capdur
=
12
# 要抓拍的视频时长
inFi
=
self
.
videoPathText
.
GetValue
()
videoLen
=
self
.
getVideoDur
(
inFi
)
curtimeO
=
self
.
getCurTimeO
()
curPath
=
globalParams
.
scriptPath
outFi
=
curPath
+
"/SDCard/video/"
+
curtimeO
+
"_"
+
str
(
videoLen
)
+
"__"
+
str
(
capTime
)
+
".mp4"
outFi
=
1
if
cam
==
1
:
outFi
=
curPath
+
"/SDCard/video/CAM_1/"
+
curtimeO
+
"_"
+
str
(
videoLen
)
+
"__"
+
str
(
capTime
)
+
".mp4"
elif
cam
==
2
:
outFi
=
curPath
+
"/SDCard/video/CAM_2/"
+
curtimeO
+
"_"
+
str
(
videoLen
)
+
"__"
+
str
(
capTime
)
+
".mp4"
elif
cam
==
3
:
outFi
=
curPath
+
"/SDCard/video/CAM_3/"
+
curtimeO
+
"_"
+
str
(
videoLen
)
+
"__"
+
str
(
capTime
)
+
".mp4"
# outFi = curPath + "/SDCard/video/" + curtimeO + "_" + str(videoLen) + "__" + str(capTime) + ".mp4"
self
.
splitVideo
(
capTime
,
capdur
,
inFi
,
outFi
)
timeCur
=
int
(
time
.
time
())
...
...
@@ -647,7 +654,14 @@ class CameraArea():
curPath
=
globalParams
.
scriptPath
videoLen
=
self
.
getVideoDur
(
inFi
)
curtimeO
=
self
.
getCurTimeO
()
outFi
=
curPath
+
"/SDCard/picture/"
+
curtimeO
+
"_"
+
str
(
videoLen
)
+
"__"
+
str
(
capTime
)
+
".jpg"
outFi
=
1
if
cam
==
1
:
outFi
=
curPath
+
"/SDCard/picture/CAM_1/"
+
curtimeO
+
"_"
+
str
(
videoLen
)
+
"__"
+
str
(
capTime
)
+
".jpg"
elif
cam
==
2
:
outFi
=
curPath
+
"/SDCard/picture/CAM_2/"
+
curtimeO
+
"_"
+
str
(
videoLen
)
+
"__"
+
str
(
capTime
)
+
".jpg"
elif
cam
==
3
:
outFi
=
curPath
+
"/SDCard/picture/CAM_3/"
+
curtimeO
+
"_"
+
str
(
videoLen
)
+
"__"
+
str
(
capTime
)
+
".jpg"
# outFi = curPath + "/SDCard/picture/" + curtimeO + "_" + str(videoLen) + "__" + str(capTime) + ".jpg"
m_command
=
[
"ffmpeg.exe"
,
"-i"
,
inFi
,
"-frames:v"
,
"1"
,
"-ss"
,
capTime
,
"-f"
,
"image2"
,
outFi
]
subprocess
.
run
(
m_command
)
...
...
ui/EventAndOtherArea.py
View file @
f73d499d
#coding: utf-8
import
json
import
os
import
sys
import
threading
import
time
import
requests
import
wx
from
pubsub
import
pub
from
ui
import
globalParams
...
...
@@ -30,6 +34,10 @@ class EventAndOtherArea():
self
.
spdlTextCtr
=
None
# 速度设置框
self
.
trsComboBox
=
None
# 定位可信度设置框
self
.
videoFilePathTextCtr
=
None
# 上传文化底子框
self
.
cameraTypeCombox
=
None
# 摄像头选择框
self
.
videoTypeCombox
=
None
# 上传文件类型选择框
self
.
logTextCtr
=
None
# 日志输出框
...
...
@@ -50,6 +58,7 @@ class EventAndOtherArea():
boxSizer
.
Add
(
bottomPanel
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
TOP
,
border
=
5
)
self
.
mainPanel
.
SetSizer
(
boxSizer
)
pub
.
subscribe
(
self
.
showLog
,
"showLog"
)
return
self
.
mainPanel
#################################################
...
...
@@ -105,11 +114,26 @@ class EventAndOtherArea():
helpButton
=
wx
.
Button
(
ctrlPannel
,
label
=
"一键救援"
,
pos
=
(
170
,
20
))
self
.
frame
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
evt
:
self
.
sendHelpEvt
(
evt
),
helpButton
)
videoUploadPannel
=
wx
.
StaticBox
(
topPanel
,
-
1
,
"视频上传:"
,
size
=
(
wx
.
EXPAND
,
50
))
wx
.
StaticText
(
videoUploadPannel
,
label
=
'文件:'
,
pos
=
(
10
,
20
))
self
.
videoFilePathTextCtr
=
wx
.
TextCtrl
(
videoUploadPannel
,
pos
=
(
60
,
15
),
size
=
wx
.
Size
(
350
,
-
1
))
selectFileButton
=
wx
.
Button
(
videoUploadPannel
,
label
=
"选择文件"
,
pos
=
(
420
,
15
))
self
.
frame
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
evt
:
self
.
selectVideoFile
(
evt
,
self
.
videoFilePathTextCtr
),
selectFileButton
)
wx
.
StaticText
(
videoUploadPannel
,
label
=
'视频类型:'
,
pos
=
(
500
,
20
))
self
.
videoTypeCombox
=
wx
.
ComboBox
(
videoUploadPannel
,
pos
=
(
570
,
15
),
choices
=
[
'手动抓拍图片'
,
'手动抓拍视频'
,
"历史视频"
,
\
"行车碰撞视频"
,
"停车碰撞视频"
,
"一键报警视频"
],
value
=
"手动抓拍图片"
,
size
=
wx
.
Size
(
100
,
-
1
))
self
.
cameraTypeCombox
=
wx
.
ComboBox
(
videoUploadPannel
,
pos
=
(
680
,
15
),
choices
=
[
'摄像头1'
,
'摄像头2'
,
"摄像头3"
,
],
value
=
"摄像头1"
,
size
=
wx
.
Size
(
80
,
-
1
))
startUploadButton
=
wx
.
Button
(
videoUploadPannel
,
label
=
"上传文件"
,
pos
=
(
770
,
15
))
self
.
frame
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
evt
:
self
.
uploadVideoFile
(
evt
),
startUploadButton
)
topPanelSizer
.
Add
(
basicInfoPanel
,
0.7
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
topPanelSizer
.
Add
(
gpsPannel
,
2
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
topPanelSizer
.
Add
(
ctrlPannel
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
otherPannel
=
wx
.
Panel
(
topPanel
,
-
1
,
size
=
(
wx
.
EXPAND
,
50
))
topPanelSizer
.
Add
(
otherPannel
,
4
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
topPanelSizer
.
Add
(
videoUploadPannel
,
1
,
flag
=
wx
.
EXPAND
|
wx
.
TOP
,
border
=
10
)
otherPannel
=
wx
.
Panel
(
topPanel
,
-
1
,
size
=
(
wx
.
EXPAND
,
50
))
topPanelSizer
.
Add
(
otherPannel
,
3
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
topPanel
.
SetSizer
(
topPanelSizer
)
return
topPanel
...
...
@@ -220,6 +244,25 @@ class EventAndOtherArea():
timeCur
=
"["
+
timeCur
+
"] "
return
timeCur
#################################################
# 打开文件选择对话框
#################################################
def
selectVideoFile
(
self
,
evt
,
textCtr
):
wildcard
=
"Video file (*.mp4)|*.mp4"
dlg
=
wx
.
FileDialog
(
self
.
frame
,
message
=
"选择flv视频文件"
,
defaultDir
=
os
.
getcwd
(),
defaultFile
=
""
,
wildcard
=
wildcard
,
style
=
wx
.
FD_OPEN
|
wx
.
FD_CHANGE_DIR
|
wx
.
FD_FILE_MUST_EXIST
|
wx
.
FD_PREVIEW
)
if
dlg
.
ShowModal
()
==
wx
.
ID_OK
:
path
=
dlg
.
GetPath
()
textCtr
.
SetValue
(
path
)
dlg
.
Destroy
()
#################################################
# 清空日志
...
...
@@ -287,5 +330,65 @@ class EventAndOtherArea():
return
data
####################################################
# 上传视频文件
####################################################
def
uploadVideoFile
(
self
,
evt
):
threadObj
=
threading
.
Thread
(
target
=
self
.
doUploadVideoFile
())
threadObj
.
start
()
timeCur
=
self
.
getCurTimeTxt
()
self
.
logTextCtr
.
WriteText
(
timeCur
+
"文件开始上传!
\n
"
)
def
doUploadVideoFile
(
self
):
params
=
{}
filePath
=
self
.
videoFilePathTextCtr
.
GetValue
()
camTxt
=
self
.
cameraTypeCombox
.
GetValue
()
cam
=
1
if
camTxt
==
"摄像头1"
:
cam
=
1
elif
camTxt
==
"摄像头2"
:
cam
=
2
elif
camTxt
==
"摄像头3"
:
cam
=
3
iscaptureTxt
=
self
.
videoTypeCombox
.
GetValue
()
iscapture
=
1
if
iscaptureTxt
==
"手动抓拍图片"
:
iscapture
=
1
elif
iscaptureTxt
==
"手动抓拍视频"
:
iscapture
=
2
elif
iscaptureTxt
==
"历史视频"
:
iscapture
=
3
elif
iscaptureTxt
==
"行车碰撞视频"
:
iscapture
=
4
elif
iscaptureTxt
==
"停车碰撞视频"
:
iscapture
=
5
elif
iscaptureTxt
==
"一键报警视频"
:
iscapture
=
6
imei
=
globalParams
.
homeArea
.
getDevCodeText
()
.
GetValue
()
lat
=
globalParams
.
eventArea
.
getLatTextCtr
()
.
GetValue
()
lng
=
globalParams
.
eventArea
.
getLngTextCtr
()
.
GetValue
()
timeCur
=
int
(
time
.
time
())
with
open
(
filePath
,
"rb"
)
as
fi
:
files
=
{
'file'
:
fi
}
params
[
"fileaddress"
]
=
"/aaa"
params
[
"cam"
]
=
cam
params
[
"imei"
]
=
imei
params
[
"iscapture"
]
=
iscapture
params
[
"lat"
]
=
lat
params
[
"lng"
]
=
lng
params
[
"time"
]
=
timeCur
res
=
requests
.
post
(
"http://api-test.vandyo.com/mirror/upload/file"
,
files
=
files
,
params
=
params
)
curTime
=
self
.
getCurTimeTxt
()
wx
.
CallAfter
(
pub
.
sendMessage
,
"showLog"
,
msg
=
curTime
+
"视频上传完成!"
)
####################################################
# 用于多线程的日志展示
####################################################
def
showLog
(
self
,
msg
):
self
.
logTextCtr
.
WriteText
(
msg
+
"
\n
"
)
ui/HomeArea.py
View file @
f73d499d
...
...
@@ -345,6 +345,12 @@ class HomeArea():
sys
.
stdout
=
self
.
logTextCtr
sys
.
stderr
=
self
.
logTextCtr
####################################################
# 获取视频文件列表
####################################################
def
getFileList
(
self
):
pass
ui/MainWindow.py
View file @
f73d499d
...
...
@@ -64,7 +64,7 @@ class MainWindow():
nodeBook
.
AddPage
(
page3
,
"摄像头3"
)
codecArea
=
CodecArea
(
nodeBook
)
page4
=
codecArea
.
create
()
nodeBook
.
AddPage
(
page4
,
"转码工具"
)
nodeBook
.
AddPage
(
page4
,
"转码
相关
工具"
)
eventAndOtherArea
=
EventAndOtherArea
(
nodeBook
)
globalParams
.
eventArea
=
eventAndOtherArea
page5
=
eventAndOtherArea
.
create
()
...
...
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