-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
77 lines (63 loc) · 2.03 KB
/
app.js
File metadata and controls
77 lines (63 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var express = require("express"),
bodyParser= require("body-parser"),
app = express();
const {PythonShell} = require("python-shell");
var sys = require('sys');
var player = require('play-sound')(opts = {});
var spawn = require("child_process").spawn;
const puretext = require('puretext');
/*var player = require('play-sound')({player: "C:/Users/sarth/Downloads/mplayer.exe"});
var baudio = require('baudio');
var play = require('audio-play'),
load = require('audio-loader');
*/
app.use(bodyParser.urlencoded({extended : true}));
app.set("view engine", "ejs");
app.use(express.static(__dirname));
app.get("/", function(req, res){
res.render("home")
});
app.post('/k', function(req, res) {
var options = {
mode: 'text',
// pythonPath: "C:/Users/hp/Anaconda3-2/python.exe",
pythonPath:"C:/Users/sarth/AppData/Local/Continuum/anaconda3/python.exe",
pythonOptions: ['-u'],
scriptPath: './',
args: ['-p','shape_predictor_68_face_landmarks.dat']
};
var shell = new PythonShell('main_drowsy.py', options);
shell.on('message', function (message) {
console.log(message);
if(message=='1')
{
//alarm'
// soundManager.url = '/path/to/swf-files/';
// create player instance
// play now and callback when playend
console.log("OH LOL!");
res.render("stop");
}
// res.render("result", {message: message, claim: claim, says:says});
// console.log("hii");
});
});
app.post('/k1', function(req, res) {
let text = {
// To Number is the number you will be sending the text to.
toNumber: '+91-971-181-5027',
// From number is the number you will buy from your admin dashboard
fromNumber: '+91-812-734-2651',
// Text Content
smsBody: 'Sending SMS using Node.js',
//Sign up for an account to get an API Token
apiToken: 'c3152e'
};
puretext.send(text, function (err, response) {
if(err) console.log(err);
else console.log(response)
})
});
app.listen(3000, "localhost", function(err){
console.log("Server on duty, Mallady!");
});