Commit 2a68f43b authored by I.K Seneviratne's avatar I.K Seneviratne

Committing the final modifications in video_results.html file and automation_process.py file.

parent fd544989
import requests import requests
import json import json
from LectureSummarizingApp.lecture_audio_batch_process import save_lecturer_audio, summarization_batch_process
from MonitorLecturerApp.logic.lecturer_batch_process import lecturer_batch_process
from .MongoModels import LectureVideo 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
...@@ -86,8 +87,13 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00") ...@@ -86,8 +87,13 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00")
"lecture_video_length": video_length "lecture_video_length": video_length
} }
# create the lecturer audio # create the lecturer audio content
lecturer_audio_content = {} lecturer_audio_content = {
"lecturer": lecturer,
"subject": subject,
"audio_name": lecturer_audio_name
}
# save the student video # save the student video
...@@ -102,7 +108,8 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00") ...@@ -102,7 +108,8 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00")
print('lecturer video response: ', lecturer_video_response) print('lecturer video response: ', lecturer_video_response)
# save the lecturer audio # save the lecturer audio
lecturer_audio_response = save_lecturer_audio(lecturer_audio_content)
audio_id = lecturer_audio_response['audio_id']
# for i in range(100): # for i in range(100):
# print('outer loop: ', i) # print('outer loop: ', i)
...@@ -112,24 +119,23 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00") ...@@ -112,24 +119,23 @@ def automation_process(lecturer, subject, subject_code, video_length="00:20:00")
# start the batch processing for lecture summarization component # start the batch processing for lecture summarization component
# lecture_summary_batch_process = lecture_summarization_batch_process(audio_name) lecture_summary_batch_process = summarization_batch_process(audio_id, lecturer_audio_name)
lecture_summary_batch_process = True
# if the lecture summarization process is successful # if the lecture summarization process is successful
# if lecture_summary_batch_process: if lecture_summary_batch_process:
#
# # start the batch processing for monitoring lecturer performance component # start the batch processing for monitoring lecturer performance component
# lecturer_batch_process_response = lecturer_batch_process(lecturer_video_name, lecturer_audio_name) lecturer_batch_process_response = lecturer_batch_process(lecturer_video_name, lecturer_audio_name)
#
# # if the lecturer performance process is successful # if the lecturer performance process is successful
# if lecturer_batch_process_response: if lecturer_batch_process_response:
#
# # start the batch processing for monitoring student behavior component # start the batch processing for monitoring student behavior component
# student_batch_process_response = student_behavior_batch_process(student_video_id, student_video_name) student_batch_process_response = student_behavior_batch_process(student_video_id, student_video_name)
#
# # if the student behavior process is successful # if the student behavior process is successful
# if student_batch_process_response: if student_batch_process_response:
# is_all_processed = True is_all_processed = True
# return the status # return the status
......
...@@ -304,68 +304,70 @@ ...@@ -304,68 +304,70 @@
} }
/*
//this is a test function (delete later) //this is a test function (delete later)
//get the due lecture video name
var due_lecture_video_name = "{{ due_lecture_video_name }}";
let interval = setInterval(() => { var isDue = {{ isDue }};
let url = 'http://127.0.0.1:8000/check-availability/?video_name=' + due_lecture_video_name; if (isDue > 0) {
let interval = setInterval(() => {
fetch(url) $('#activity_loader').attr('hidden', false);
.then((res) => res.json())
.then((out) => displayProcess(out))
.catch((err) => alert('error: ' + err))
}, 5000); //get the due lecture video name
var due_lecture_video_name = "{{ due_lecture_video_name }}";
let url = 'http://127.0.0.1:8000/check-availability/?video_name=' + due_lecture_video_name;
fetch(url)
.then((res) => res.json())
.then((out) => displayProcess(out))
.catch((err) => alert('error: ' + err))
//this function will handle the displaying loaders and status in the workflow }, 5000);
function displayProcess(response) {
//if the lecture activity has completed processing //this function will handle the displaying loaders and status in the workflow
if (response.isActivityExist) { function displayProcess(response) {
$('#step_1').attr("class", class1); //if the lecture activity has completed processing
$('#activity_loader').hide(); if (response.isActivityExist) {
$('#emotion_loader').attr('hidden', false);
} $('#step_1').attr("class", class1);
$('#activity_loader').hide();
$('#emotion_loader').attr('hidden', false);
//if the lecture emotion has completed processing }
if (response.isEmotionExist) {
$('#step_2').attr("class", class1); //if the lecture emotion has completed processing
$('#emotion_loader').hide(); if (response.isEmotionExist) {
$('#gaze_loader').attr('hidden', false);
} $('#step_2').attr("class", class1);
$('#emotion_loader').hide();
$('#gaze_loader').attr('hidden', false);
//if the lecture gaze has completed processing }
if (response.isGazeExist) {
$('#step_3').attr("class", class1); //if the lecture gaze has completed processing
$('#gaze_loader').hide(); if (response.isGazeExist) {
}
//if all the processes are completed $('#step_3').attr("class", class1);
if (response.isActivityExist && response.isEmotionExist && response.isGazeExist) { $('#gaze_loader').hide();
}
var x = document.getElementById("snackbar"); //if all the processes are completed
x.className = "show"; if (response.isActivityExist && response.isEmotionExist && response.isGazeExist) {
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 3000);
//clear the setInterval function var x = document.getElementById("snackbar");
clearInterval(interval); x.className = "show";
} setTimeout(function () {
x.className = x.className.replace("show", "");
}, 3000);
//clear the setInterval function
clearInterval(interval);
}
}
*/ }
}
}); });
...@@ -450,11 +452,11 @@ ...@@ -450,11 +452,11 @@
<td class="font-weight-bolder">{{ lecture.end_time }}</td> <td class="font-weight-bolder">{{ lecture.end_time }}</td>
<td> <td>
<span class="font-italic text-success" id="processing" hidden>Processing</span> <span class="font-italic text-success" id="processing" hidden>Processing</span>
<button type="button" class="btn btn-success batch_process" {# <button type="button" class="btn btn-success batch_process"#}
data-video-id="{{ lecture.video_id }}" {# data-video-id="{{ lecture.video_id }}"#}
data-video-name="{{ lecture.video_name }}" {# data-video-name="{{ lecture.video_name }}"#}
id="{{ lecture.subject }}">Process {# id="{{ lecture.subject }}">Process#}
</button> {# </button>#}
{# <span class="font-italic font-weight-bolder text-success">Processing</span>#} {# <span class="font-italic font-weight-bolder text-success">Processing</span>#}
</td> </td>
</tr> </tr>
......
...@@ -294,8 +294,11 @@ def video_result(request): ...@@ -294,8 +294,11 @@ def video_result(request):
# due_lecture_video_name = "Test.mp4" # due_lecture_video_name = "Test.mp4"
print('due lecture video name: ', due_lecture_video_name) print('due lecture video name: ', due_lecture_video_name)
# check whether there are due lectures or not
isDue = len(due_lecture_list)
return render(request, "FirstApp/video_results.html", return render(request, "FirstApp/video_results.html",
{"lecturer": lecturer, "due_lectures": due_lecture_list, "due_lecture_video_name": due_lecture_video_name}) {"lecturer": lecturer, "due_lectures": due_lecture_list, "due_lecture_video_name": due_lecture_video_name, 'isDue': isDue})
# view for emotion page # view for emotion page
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment