diff --git a/securityModule/Face/__pycache__/sercurity_module.cpython-37.pyc b/securityModule/Face/__pycache__/sercurity_module.cpython-37.pyc index 64f7213..6a6b4e0 100644 Binary files a/securityModule/Face/__pycache__/sercurity_module.cpython-37.pyc and b/securityModule/Face/__pycache__/sercurity_module.cpython-37.pyc differ diff --git a/securityModule/Face/templates/index.html b/securityModule/Face/templates/index.html index ece095d..f88f00d 100644 --- a/securityModule/Face/templates/index.html +++ b/securityModule/Face/templates/index.html @@ -163,22 +163,6 @@
Camera 1 Logs
-
-
-
Camera 2 Logs
-
-
- -
-
@@ -190,9 +174,7 @@
Camera 2 Logs
get_camera1_Logs(); - get_camera2_Logs(); - function get_camera1_Logs(){ $.ajax({ type: 'POST', @@ -201,7 +183,7 @@
Camera 2 Logs
success: function(data){ let proxy = JSON.parse(data); let camera1 = $('#camera1').data('value'); - if (camera1 == "on"){ + if (camera1 == "on" && proxy['name'] != 'undefined'){ $('#result1').append( "
  • "+ proxy['time']+ ": "+ proxy['name'] +"
  • " ); } }, @@ -212,24 +194,24 @@
    Camera 2 Logs
    }); } - function get_camera2_Logs(){ - $.ajax({ - type: 'POST', - url: "/_view_logii", - dataType: "text", - success: function(data){ - let proxy = JSON.parse(data); - let camera2 = $('#camera2').data('value'); - if (camera2 == "on"){ - $('#result2').append( "
  • "+proxy['time']+ ": "+ proxy['name'] +"
  • " ); - } - }, - complete: function() { - // Schedule the next request when the current one's complete - setTimeout(get_camera2_Logs, 5000); - } - }); - } + // function get_camera2_Logs(){ + // $.ajax({ + // type: 'POST', + // url: "/_view_logii", + // dataType: "text", + // success: function(data){ + // let proxy = JSON.parse(data); + // let camera2 = $('#camera2').data('value'); + // if (camera2 == "on"){ + // $('#result2').append( "
  • "+proxy['time']+ ": "+ proxy['name'] +"
  • " ); + // } + // }, + // complete: function() { + // // Schedule the next request when the current one's complete + // setTimeout(get_camera2_Logs, 5000); + // } + // }); + // } // function get_camera3_Logs(){ // $.ajax({ diff --git a/securityModule/Face/webstreaming.py b/securityModule/Face/webstreaming.py index e9b18f9..11e9ee7 100644 --- a/securityModule/Face/webstreaming.py +++ b/securityModule/Face/webstreaming.py @@ -1,6 +1,6 @@ # USAGE # python webstreaming.py --ip 0.0.0.0 --port 8000 - +from twilio.rest import Client # import the necessary packages from sercurity_module import Sercurity # from imutils.video import VideoStream @@ -20,7 +20,7 @@ from firebase_admin import credentials, firestore import json -cred = credentials.Certificate('/home/haotian/uoftHacks2020/supervisor-f2f29-firebase-adminsdk-l2twy-ae836f2735.json') +cred = credentials.Certificate('/Users/vaishvik/Desktop/uoftHacks2020/supervisor-f2f29-firebase-adminsdk-l2twy-ae836f2735.json') default_app = firebase_admin.initialize_app(cred) @@ -44,22 +44,25 @@ doc_ref.set(Gfeatures) +def send_msg(number, data): + account_sid = os.environ["TWILIO_ACCOUNT_SID"] + auth_token = os.environ["TWILIO_AUTH_TOKEN"] + client = Client(account_sid, auth_token) + # This my person phone number + client.messages.create(to=number, from_="12563803381", body=data) -def send_log(detected1, detected2): +def send_log(detected1): t = time.localtime() current_time = time.strftime("%H:%M:%S", t) - if (detected1 != None): - doc_ref = db.collection(u'Camera').document(u'camera1') - doc_ref.update({ "Log":{"time": current_time, "name":detected1}}) - if (detected2 != None): - doc_ref = db.collection(u'Camera').document(u'camera2') - doc_ref.update({ "Log":{"time": current_time, "name":detected2}}) + doc_ref = db.collection(u'Camera').document(u'camera1') + doc_ref.update({ "Log":{"time": current_time, "name":detected1}}) + # Use Case of the function -send_log(None, "Tien") -send_log("Vash", "goku") -send_log("Vash", None) +send_log("Tien") +send_log("goku") +send_log("Disco") # initialize the output frame and a lock used to ensure thread-safe # exchanges of the output frames (useful for multiple browsers/tabs @@ -138,7 +141,9 @@ def detect_motion(frameCount, datasets_path, vs): # print(dangers) if dangers != None: print(dangers[0].tostring(), "detected!!!!!!!, Confidence score =", danger_scores[0]) - send_log(dangers[0].tostring(), None) + send_log(dangers[0].tostring()) + send_msg(6473348273, dangers[0].tostring()) + mo, frame_marked = sr.detect_and_show(new_frame, total, frameCount) if mo: