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
8429be0b
Commit
8429be0b
authored
Feb 03, 2021
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复了文件上传失败的bug
parent
f60d38f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
ui/CameraArea.py
ui/CameraArea.py
+11
-9
ui/EventAndOtherArea.py
ui/EventAndOtherArea.py
+5
-3
No files found.
ui/CameraArea.py
View file @
8429be0b
...
...
@@ -621,9 +621,12 @@ class CameraArea():
imei
=
globalParams
.
homeArea
.
getDevCodeText
()
.
GetValue
()
lat
=
globalParams
.
eventArea
.
getLatTextCtr
()
.
GetValue
()
lng
=
globalParams
.
eventArea
.
getLngTextCtr
()
.
GetValue
()
fsize
=
os
.
path
.
getsize
(
filePath
)
fsize
=
int
(
fsize
/
1024
)
with
open
(
filePath
,
"rb"
)
as
fi
:
files
=
{
'file'
:
fi
}
params
[
"fileaddress"
]
=
"/aaa"
params
[
"fsize"
]
=
fsize
params
[
"fileaddress"
]
=
filePath
params
[
"cam"
]
=
cam
params
[
"imei"
]
=
imei
params
[
"iscapture"
]
=
iscapture
...
...
@@ -650,13 +653,13 @@ class CameraArea():
theDate
=
self
.
getCurDate
()
# 视频抓拍日期
theTime
=
self
.
getCurTheTume
()
# 视频抓拍时间
videoLen
=
self
.
getVideoDur
(
inFi
)
# 视频总时长
capTime
=
str
(
int
(
self
.
pushObj
.
getTimeStamp
()
/
1000
))
# 从第几秒开始截取的
capTime
=
int
(
self
.
pushObj
.
getTimeStamp
()
/
1000
)
# 从第几秒开始截取的
if
cam
==
1
:
outFi
=
curPath
+
"/SDCard/
picture/CAM_1/"
+
"VID
"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".mp4"
outFi
=
curPath
+
"/SDCard/
video/CAM_1/"
+
"VID_
"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".mp4"
elif
cam
==
2
:
outFi
=
curPath
+
"/SDCard/
picture/CAM_2/"
+
"VID
"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".mp4"
outFi
=
curPath
+
"/SDCard/
video/CAM_2/"
+
"VID_
"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".mp4"
elif
cam
==
3
:
outFi
=
curPath
+
"/SDCard/
picture/CAM_3/"
+
"VID
"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".mp4"
outFi
=
curPath
+
"/SDCard/
video/CAM_3/"
+
"VID_
"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".mp4"
self
.
splitVideo
(
capTime
,
capdur
,
inFi
,
outFi
)
timeCur
=
int
(
time
.
time
())
self
.
uploadFile
(
cam
,
outFi
,
2
,
timeCur
)
...
...
@@ -670,7 +673,6 @@ class CameraArea():
def
picCapture
(
self
,
cam
,
replyMsg
,
ws
):
threadObj
=
threading
.
Thread
(
target
=
self
.
doPicCapture
,
args
=
(
cam
,
replyMsg
,
ws
,))
threadObj
.
start
()
#"ffmpeg -i bbb.mp4 -frames:v 1 -ss 40 -f image2 bbb.jpg"
def
doPicCapture
(
self
,
cam
,
replyMsg
,
ws
):
cutTime
=
self
.
getCurTime
()
if
self
.
pushObj
==
None
:
...
...
@@ -684,11 +686,11 @@ class CameraArea():
videoLen
=
self
.
getVideoDur
(
inFi
)
# 视频总时长
capTime
=
str
(
int
(
self
.
pushObj
.
getTimeStamp
()
/
1000
))
# 从第几秒开始截取的
if
cam
==
1
:
outFi
=
curPath
+
"/SDCard/picture/CAM_1/"
+
"PIC"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".jpg"
outFi
=
curPath
+
"/SDCard/picture/CAM_1/"
+
"PIC
_
"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".jpg"
elif
cam
==
2
:
outFi
=
curPath
+
"/SDCard/picture/CAM_2/"
+
"PIC"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".jpg"
outFi
=
curPath
+
"/SDCard/picture/CAM_2/"
+
"PIC
_
"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".jpg"
elif
cam
==
3
:
outFi
=
curPath
+
"/SDCard/picture/CAM_3/"
+
"PIC"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".jpg"
outFi
=
curPath
+
"/SDCard/picture/CAM_3/"
+
"PIC
_
"
+
str
(
videoLen
)
+
"_"
+
str
(
capTime
)
+
"_"
+
theDate
+
"_"
+
theTime
+
".jpg"
m_command
=
[
"ffmpeg.exe"
,
"-i"
,
inFi
,
"-frames:v"
,
"1"
,
"-ss"
,
capTime
,
"-f"
,
"image2"
,
outFi
]
subprocess
.
run
(
m_command
)
...
...
ui/EventAndOtherArea.py
View file @
8429be0b
...
...
@@ -248,7 +248,7 @@ class EventAndOtherArea():
# 打开文件选择对话框
#################################################
def
selectVideoFile
(
self
,
evt
,
textCtr
):
wildcard
=
"Video file (*.mp4
)|*.mp4
"
wildcard
=
"Video file (*.mp4
;*.jpg)|*.mp4;*.jpg
"
dlg
=
wx
.
FileDialog
(
self
.
frame
,
message
=
"选择flv视频文件"
,
defaultDir
=
os
.
getcwd
(),
...
...
@@ -370,10 +370,12 @@ class EventAndOtherArea():
lat
=
globalParams
.
eventArea
.
getLatTextCtr
()
.
GetValue
()
lng
=
globalParams
.
eventArea
.
getLngTextCtr
()
.
GetValue
()
timeCur
=
int
(
time
.
time
())
fsize
=
os
.
path
.
getsize
(
filePath
)
fsize
=
int
(
fsize
/
1024
)
with
open
(
filePath
,
"rb"
)
as
fi
:
files
=
{
'file'
:
fi
}
params
[
"fileaddress"
]
=
"/aaa"
params
[
"fileaddress"
]
=
filePath
params
[
"fsize"
]
=
fsize
params
[
"cam"
]
=
cam
params
[
"imei"
]
=
imei
params
[
"iscapture"
]
=
iscapture
...
...
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