Toggle navigation
Toggle navigation
This project
Loading...
Sign in
cse437_e
/
smartdoorlock-backend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김유현
2020-11-21 13:18:32 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4daff81648bdcfa06d1ac80cdf71037c167281cd
4daff816
1 parent
62a24c3c
Fix typo
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
videorecord.py
videorecord.py
View file @
4daff81
...
...
@@ -51,7 +51,7 @@ def record() :
vid_name
=
now
.
strftime
(
'
%
Y
%
m
%
d-
%
H
%
M
%
S'
)
vid_path
=
path
+
'/'
+
vid_name
h264_vid_path
=
vid_path
+
'.h264'
mp4_vid_path
=
vid_path
+
'.
h26
4'
mp4_vid_path
=
vid_path
+
'.
mp
4'
thumbnail_path
=
path
+
'/'
+
vid_name
+
'.jpg'
camera
.
start_recording
(
output
=
h264_vid_path
)
...
...
@@ -69,7 +69,7 @@ def record() :
# s3 upload
s3
=
boto3
.
client
(
's3'
,
region_name
=
'ap-northeast-2'
,
aws_access_key_id
=
S3_ACCESS_KEY_ID
,
aws_secret_access_key
=
S3_SECRET_ACCESS_KEY
)
s3
.
upload_file
(
Filename
=
vid_path
,
Bucket
=
S3_STORAGE_BUCKET_NAME
,
Key
=
vid_name
+
'.mp4'
)
s3
.
upload_file
(
Filename
=
mp4_
vid_path
,
Bucket
=
S3_STORAGE_BUCKET_NAME
,
Key
=
vid_name
+
'.mp4'
)
s3
.
upload_file
(
Filename
=
thumbnail_path
,
Bucket
=
S3_STORAGE_BUCKET_NAME
,
Key
=
vid_name
+
'_thumb.jpg'
)
uploadVideo
=
{}
...
...
@@ -81,7 +81,8 @@ def record() :
serializer
.
is_valid
()
serializer
.
save
()
print
(
vid_path
,
"upload success"
)
os
.
remove
(
vid_path
)
os
.
remove
(
h264_vid_path
)
os
.
remove
(
mp4_vid_path
)
os
.
remove
(
thumbnail_path
)
else
:
camera
.
stop_preview
()
...
...
Please
register
or
login
to post a comment