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-20 19:20:53 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b4d7dfbfb24ffa07c61988bab182582e0bb6046c
b4d7dfbf
1 parent
bc2772a3
merge branch
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 additions
and
69 deletions
api/migrations/0001_initial.py
api/views.py
process/doorlock.py → doorlock.py
process/videorecord.py → videorecord.py
api/migrations/0001_initial.py
deleted
100644 → 0
View file @
bc2772a
# Generated by Django 3.1.2 on 2020-11-20 01:49
from
django.db
import
migrations
,
models
import
django.utils.timezone
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'AddDevice'
,
fields
=
[
(
'id'
,
models
.
IntegerField
(
primary_key
=
True
,
serialize
=
False
)),
(
'state'
,
models
.
BooleanField
(
default
=
False
)),
],
),
migrations
.
CreateModel
(
name
=
'Device'
,
fields
=
[
(
'device_id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'rfid_id'
,
models
.
CharField
(
max_length
=
255
)),
(
'created'
,
models
.
DateTimeField
(
default
=
django
.
utils
.
timezone
.
now
)),
],
),
migrations
.
CreateModel
(
name
=
'Door'
,
fields
=
[
(
'door_id'
,
models
.
CharField
(
max_length
=
255
,
primary_key
=
True
,
serialize
=
False
)),
],
),
migrations
.
CreateModel
(
name
=
'Lock'
,
fields
=
[
(
'id'
,
models
.
IntegerField
(
primary_key
=
True
,
serialize
=
False
)),
(
'state'
,
models
.
BooleanField
(
default
=
True
)),
],
),
migrations
.
CreateModel
(
name
=
'Record'
,
fields
=
[
(
'id'
,
models
.
IntegerField
(
primary_key
=
True
,
serialize
=
False
)),
(
'recording'
,
models
.
BooleanField
(
default
=
True
)),
],
),
migrations
.
CreateModel
(
name
=
'RemoteHistory'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'device_name'
,
models
.
CharField
(
max_length
=
255
)),
(
'created'
,
models
.
DateTimeField
(
default
=
django
.
utils
.
timezone
.
now
)),
],
),
migrations
.
CreateModel
(
name
=
'Video'
,
fields
=
[
(
'vid_name'
,
models
.
CharField
(
max_length
=
255
,
primary_key
=
True
,
serialize
=
False
)),
(
'created'
,
models
.
DateTimeField
(
default
=
django
.
utils
.
timezone
.
now
)),
(
'vid_time'
,
models
.
CharField
(
max_length
=
255
)),
(
'thumb'
,
models
.
CharField
(
max_length
=
255
)),
],
),
]
api/views.py
View file @
b4d7dfb
...
...
@@ -11,7 +11,6 @@ from api.videorecord import record
from
api.models
import
Video
,
Device
,
RemoteHistory
,
Lock
,
Record
,
Door
,
AddDevice
from
api.serializers
import
VideoSerializer
,
DeviceSerializer
,
RemoteHistorySerializer
,
RecordSerializer
,
LockSerializer
,
AddDeviceSerializer
from
rest_framework
import
status
from
rest_framework.views
import
APIView
from
rest_framework.request
import
Request
...
...
process/
doorlock.py
→
doorlock.py
View file @
b4d7dfb
File moved
process/
videorecord.py
→
videorecord.py
View file @
b4d7dfb
...
...
@@ -60,7 +60,7 @@ def record() :
start_time
=
time
.
time
()
vid_name
=
now
.
strftime
(
'
%
Y
%
m
%
d-
%
H
%
M
%
S'
)
vid_path
=
path
+
'/'
+
vid_name
+
'.
h26
4'
vid_path
=
path
+
'/'
+
vid_name
+
'.
mp
4'
thumbnail_path
=
path
+
'/'
+
vid_name
+
'.jpg'
camera
.
start_recording
(
output
=
vid_path
)
...
...
Please
register
or
login
to post a comment