Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-101
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sachith Fernando
2020-101
Commits
aa31a5c7
Commit
aa31a5c7
authored
Jan 07, 2021
by
I.K Seneviratne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Committing the implementations of the django-background-tasks library.
parent
fdd96901
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
5 deletions
+24
-5
FirstApp/automation_process.py
FirstApp/automation_process.py
+12
-1
FirstApp/logic/batch_process.py
FirstApp/logic/batch_process.py
+2
-0
FirstApp/views.py
FirstApp/views.py
+7
-2
integrated_slpes/settings.py
integrated_slpes/settings.py
+2
-1
integrated_slpes/urls.py
integrated_slpes/urls.py
+1
-1
No files found.
FirstApp/automation_process.py
View file @
aa31a5c7
import
requests
import
requests
import
json
import
json
from
background_task
import
background
from
.MongoModels
import
LectureVideo
from
.
logic
import
batch_process
as
bp
from
.
logic
import
batch_process
as
bp
from
MonitorLecturerApp.logic
import
lecturer_batch_process
as
lbp
from
MonitorLecturerApp.logic
import
lecturer_batch_process
as
lbp
import
datetime
import
datetime
# this method will save the lecture video
# this method will save the lecture video
#
#
...
@@ -43,6 +47,10 @@ import datetime
...
@@ -43,6 +47,10 @@ import datetime
# return response[0]
# return response[0]
# this method will handle the batch processing and video/audio saving pf the system
# this method will handle the batch processing and video/audio saving pf the system
from
.serializers
import
LectureVideoSerializer
# @background(schedule=5)
def
automation_process
(
lecturer
,
subject
,
subject_code
,
video_length
=
"00:20:00"
):
def
automation_process
(
lecturer
,
subject
,
subject_code
,
video_length
=
"00:20:00"
):
current_date
=
datetime
.
datetime
.
now
()
.
date
()
current_date
=
datetime
.
datetime
.
now
()
.
date
()
...
@@ -80,10 +88,12 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00")
...
@@ -80,10 +88,12 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00")
# create the lecturer audio
# create the lecturer audio
lecturer_audio_content
=
{}
lecturer_audio_content
=
{}
# save the student video
# save the student video
student_video_response
=
bp
.
save_student_lecture_video
(
student_video_content
)
student_video_response
=
bp
.
save_student_lecture_video
(
student_video_content
)
# student_video_response = save_student_lecture_video(student_video_content)
# student_video_response = save_student_lecture_video(student_video_content)
student_video_id
=
student_video_response
[
'id'
]
print
(
'student video response: '
,
student_video_response
)
# student_video_id = student_video_response['id']
# save the lecturer video
# save the lecturer video
lecturer_video_response
=
lbp
.
save_lecturer_video_details
(
lecturer_video_content
)
lecturer_video_response
=
lbp
.
save_lecturer_video_details
(
lecturer_video_content
)
...
@@ -117,6 +127,7 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00")
...
@@ -117,6 +127,7 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00")
# return the status
# return the status
return
is_all_processed
return
is_all_processed
# test the above method using 'main' method
# test the above method using 'main' method
# if __name__ == '__main__':
# if __name__ == '__main__':
#
#
...
...
FirstApp/logic/batch_process.py
View file @
aa31a5c7
import
requests
import
requests
import
json
import
json
from
background_task
import
background
def
student_behavior_batch_process
(
video_id
,
video_name
):
def
student_behavior_batch_process
(
video_id
,
video_name
):
...
@@ -30,6 +31,7 @@ def student_behavior_batch_process(video_id, video_name):
...
@@ -30,6 +31,7 @@ def student_behavior_batch_process(video_id, video_name):
# this method will save the student lecture video
# this method will save the student lecture video
# @background(schedule=5)
def
save_student_lecture_video
(
student_video
):
def
save_student_lecture_video
(
student_video
):
data_dumps
=
json
.
dumps
(
student_video
)
data_dumps
=
json
.
dumps
(
student_video
)
...
...
FirstApp/views.py
View file @
aa31a5c7
...
@@ -29,6 +29,7 @@ from django.contrib.auth import (
...
@@ -29,6 +29,7 @@ from django.contrib.auth import (
logout
,
logout
,
)
)
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.decorators
import
login_required
from
.
serializers
import
*
from
.
serializers
import
*
from
.
forms
import
*
from
.
forms
import
*
import
os
import
os
...
@@ -232,8 +233,6 @@ def video_result(request):
...
@@ -232,8 +233,6 @@ def video_result(request):
for
item
in
to_do_lecture_list
:
for
item
in
to_do_lecture_list
:
isDate
=
item
[
'date'
]
==
str
(
day_timetable
[
'date'
])
isDate
=
item
[
'date'
]
==
str
(
day_timetable
[
'date'
])
print
(
'item date: '
,
item
[
'date'
])
print
(
'timetable date: '
,
str
(
day_timetable
[
'date'
]))
# isLecturer = item['lecturer'] ==
# isLecturer = item['lecturer'] ==
# check for the particular lecture on the day
# check for the particular lecture on the day
if
isDate
:
if
isDate
:
...
@@ -246,6 +245,12 @@ def video_result(request):
...
@@ -246,6 +245,12 @@ def video_result(request):
isLecturer
=
item
[
'lecturer'
]
==
slot
[
'lecturer'
][
'id'
]
isLecturer
=
item
[
'lecturer'
]
==
slot
[
'lecturer'
][
'id'
]
isSubject
=
item
[
'subject'
]
==
slot
[
'subject'
][
'id'
]
isSubject
=
item
[
'subject'
]
==
slot
[
'subject'
][
'id'
]
print
(
'item lecturer: '
,
item
[
'lecturer'
])
print
(
'timetable lecturer: '
,
slot
[
'lecturer'
][
'id'
])
print
(
'item subject: '
,
item
[
'subject'
])
print
(
'timetable subject: '
,
slot
[
'subject'
][
'id'
])
if
isLecturer
&
isSubject
:
if
isLecturer
&
isSubject
:
obj
=
{}
obj
=
{}
obj
[
'date'
]
=
item
[
'date'
]
obj
[
'date'
]
=
item
[
'date'
]
...
...
integrated_slpes/settings.py
View file @
aa31a5c7
...
@@ -43,7 +43,8 @@ INSTALLED_APPS = [
...
@@ -43,7 +43,8 @@ INSTALLED_APPS = [
'django.contrib.staticfiles'
,
'django.contrib.staticfiles'
,
'bootstrap4'
,
'bootstrap4'
,
'rest_framework'
,
'rest_framework'
,
'os'
'os'
,
'background_task'
]
]
MIDDLEWARE
=
[
MIDDLEWARE
=
[
...
...
integrated_slpes/urls.py
View file @
aa31a5c7
...
@@ -25,5 +25,5 @@ urlpatterns = [
...
@@ -25,5 +25,5 @@ urlpatterns = [
path
(
'lecturer/'
,
include
(
'MonitorLecturerApp.urls'
)),
path
(
'lecturer/'
,
include
(
'MonitorLecturerApp.urls'
)),
# path('lecturer/', include('MonitorLecturerApp.urls')),
# path('lecturer/', include('MonitorLecturerApp.urls')),
path
(
'summary/'
,
include
(
'LectureSummarizingApp.urls'
)),
path
(
'summary/'
,
include
(
'LectureSummarizingApp.urls'
)),
path
(
'record/'
,
include
(
'LectureSummarizingApp.urls'
))
path
(
'record/'
,
include
(
'LectureSummarizingApp.urls'
))
,
]
]
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