diff --git a/CitySecurity/app_server/controller/homeController.js b/CitySecurity/app_server/controller/homeController.js index 8bd96c1..e9ca3d0 100644 --- a/CitySecurity/app_server/controller/homeController.js +++ b/CitySecurity/app_server/controller/homeController.js @@ -1,4 +1,8 @@ var path = require('path'); module.exports.index=function(req,res){ res.render('home'); +} + +module.exports.aboutUs=function(req,res){ + res.render('aboutUs'); } \ No newline at end of file diff --git a/CitySecurity/app_server/controller/loginController.js b/CitySecurity/app_server/controller/loginController.js index a54ef5e..819d137 100644 --- a/CitySecurity/app_server/controller/loginController.js +++ b/CitySecurity/app_server/controller/loginController.js @@ -20,6 +20,7 @@ module.exports.indexPost = function (req, res) { if (req.body.password == userResult[0].password) { res.render('home'); + } else { res.render('login',{ diff --git a/CitySecurity/app_server/controller/monitoringController.js b/CitySecurity/app_server/controller/monitoringController.js index f61b553..f02ac64 100644 --- a/CitySecurity/app_server/controller/monitoringController.js +++ b/CitySecurity/app_server/controller/monitoringController.js @@ -1,30 +1,54 @@ - -var user = require('../models/dbIslemleri.js'); -var path = require('path'); -var ejsLayouts=require('express-ejs-layouts'); +var db = require('../models/database.js'); +// var path = require('path'); +// var ejsLayouts = require('express-ejs-layouts'); //const { Storage } = require('@google-cloud/storage'); +var arrayDanger = []; +// var sayac = 0; +var danger = 'danger'; +var notDanger = 'not danger'; +module.exports.monGet = function (req, res) { + + res.render('newMonitoring', { + jsonArray: "null" + }); +} +var dangerLabelDetect = function video() { + + var queryList = "SELECT * FROM dangerlabel"; + db.query(queryList, function (err, results, fields) { + results.forEach(element => { + arrayDanger.push(element.labelName); -module.exports.monGet=function(req,res) { - - res.render('newMonitoring',{ - jsonArray:"null" + }); }); + } module.exports.monList = function (req, res) { - res.render('listMonitoring', { - jsonArray:"null" - - }) + dangerLabelDetect(); + var queryList = "SELECT * FROM returnlabel"; + db.query(queryList, function (err, results, fields) { + if (err) throw err.message + else { + res.render('listMonitoring', { + jsonArray: results + + }) + } + }); + } module.exports.monNew = function (req, res) { + dangerLabelDetect(); + var video_isle = async function Video() { var jsonArray; const video = require('@google-cloud/video-intelligence').v1; - var jsonArrayTextex; + var jsonArrayTextex; const client = new video.VideoIntelligenceServiceClient(); - const gcsUri = 'gs://mts-bucket/cat.mp4'; + const videoName = 'cat'; + const gcsUri = 'gs://mts-bucket/' + videoName + '.mp4'; const request = { inputUri: gcsUri, @@ -35,12 +59,21 @@ module.exports.monNew = function (req, res) { const [operationResult] = await operation.promise(); const annotations = operationResult.annotationResults[0]; - var jsonArrayText ='{"labels":['; + var jsonArrayText = '{"labels":['; const labels = annotations.segmentLabelAnnotations; labels.forEach(label => { + console.log(`Label ${label.entity.description} occurs at:`); - jsonArrayText += '{ "LabelName":' +'"'+label.entity.description+'"'+','; + jsonArrayText += '{ "LabelName":' + '"' + label.entity.description + '"' + ','; + if (arrayDanger.includes(String(label.entity.description))) { + + jsonArrayText += '"danger":' + '"' + danger + '"' + ','; + console.log("selam"); + } + else { + jsonArrayText += '"danger":' + '"' + notDanger + '"' + ','; + } label.segments.forEach(segment => { const time = segment.segment; @@ -65,7 +98,8 @@ module.exports.monNew = function (req, res) { `${(time.endTimeOffset.nanos / 1e6).toFixed(0)}s` ); console.log(`\tConfidence: ${segment.confidence}`); - jsonArrayText +='"confidence":'+'"'+segment.confidence+'" },'; + jsonArrayText += '"confidence":' + '"' + segment.confidence +'" },'; + @@ -74,19 +108,28 @@ module.exports.monNew = function (req, res) { //jsonArrayText -=','; var n = jsonArrayText.length; - jsonArrayText = jsonArrayText.substr(0,n-1); + jsonArrayText = jsonArrayText.substr(0, n - 1); + + jsonArrayText += ']}'; - jsonArrayText +=']}'; - jsonArray = JSON.parse(jsonArrayText); res.render('newMonitoring', { - jsonArray:jsonArray + jsonArray: jsonArray, - }) + sayac++; + for (var i = 0; i < Object.keys(jsonArray.labels).length; i++) { + var queryInsert = "INSERT INTO returnlabel VALUES(' ','" + jsonArray.labels[i].LabelName + "','" + jsonArray.labels[i].confidence + "',NOW(),1,'" + videoName + "')"; + db.query(queryInsert, function (err, results, fields) {//ekleme işlemi + if (err) throw err.message; + + + }); + + } } - // console.log(labels.length); + // console.log(labels.length); console.log("Got a GET request for the homepage"); console.log("video işleniyor"); video_isle(); diff --git a/CitySecurity/app_server/models/dbIslemleri.js b/CitySecurity/app_server/models/dbIslemleri.js deleted file mode 100644 index 66a86e5..0000000 --- a/CitySecurity/app_server/models/dbIslemleri.js +++ /dev/null @@ -1,5 +0,0 @@ -var db=require('./database'); -var queryUser="SELECT `password` FROM `usertable` WHERE `username`='admin'"; - - - diff --git a/CitySecurity/app_server/route/homeRoute.js b/CitySecurity/app_server/route/homeRoute.js index a1d9ead..bc1171b 100644 --- a/CitySecurity/app_server/route/homeRoute.js +++ b/CitySecurity/app_server/route/homeRoute.js @@ -3,4 +3,5 @@ var router=express.Router(); var ctrlHome=require('../controller/homeController'); router.get('/',ctrlHome.index); +router.get('/aboutUs',ctrlHome.aboutUs); module.exports=router; \ No newline at end of file diff --git a/CitySecurity/app_server/route/routeManager.js b/CitySecurity/app_server/route/routeManager.js index 05841c9..d01bb2a 100644 --- a/CitySecurity/app_server/route/routeManager.js +++ b/CitySecurity/app_server/route/routeManager.js @@ -12,4 +12,5 @@ module.exports = function (app) { app.use('/home', routeHome); app.use('/monitoring', routeMon); + } \ No newline at end of file diff --git a/CitySecurity/app_server/view/aboutUs.ejs b/CitySecurity/app_server/view/aboutUs.ejs new file mode 100644 index 0000000..350cc83 --- /dev/null +++ b/CitySecurity/app_server/view/aboutUs.ejs @@ -0,0 +1,200 @@ +<%- include('header') -%> + + + +
+ +

+ Teams +

+ + +
+ +
+ +
+
+
+
+
+ +
+
Meral + Taşdemir
+
meraltaşdemir +
+ +
+ +    + |    +    + +    + +    + +
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
Zişan + Karsatar
+
zisankarsatar +
+ +
+ +    + |    +    + +    + +    + +
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
M. Taha + Soydan
+
mts
+ + +
+ +    + |    +    + +    +    + +
+
+
+
+
+
+
+
+
+
+
+ +
+
Bahar + Yılmaz
+
baharyilmaz +
+ +
+
+ baharr.yilmaz48@gmail.com
+    + +    + |    +    +    + + +
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+
Berkan + Şaşmaz
+
berkansasmaz +
+ + +
+ +    + |    +    + +    + +    + +
+
+ +
+
+
+
+
+ +
+
+
+ + + <%- include('footer') -%> \ No newline at end of file diff --git a/CitySecurity/app_server/view/footer.ejs b/CitySecurity/app_server/view/footer.ejs index 51410bf..7604f81 100644 --- a/CitySecurity/app_server/view/footer.ejs +++ b/CitySecurity/app_server/view/footer.ejs @@ -1,31 +1,45 @@
- + + + + + + + - + \ No newline at end of file diff --git a/CitySecurity/app_server/view/header.ejs b/CitySecurity/app_server/view/header.ejs index 1e57fda..f6602b2 100644 --- a/CitySecurity/app_server/view/header.ejs +++ b/CitySecurity/app_server/view/header.ejs @@ -8,7 +8,8 @@ - + + @@ -17,7 +18,7 @@
- +
diff --git a/CitySecurity/app_server/view/listMonitoring.ejs b/CitySecurity/app_server/view/listMonitoring.ejs index cd0c90e..f718c4a 100644 --- a/CitySecurity/app_server/view/listMonitoring.ejs +++ b/CitySecurity/app_server/view/listMonitoring.ejs @@ -6,7 +6,8 @@
- +
@@ -25,30 +26,29 @@ Name Label - Label Category Confidence + creation Time - <%if(jsonArray=="null"){%> + <%if(Object.keys(jsonArray).length>0){%> + <%for(var i=0; i < Object.keys(jsonArray).length; i++){%> + + + + <%= jsonArray[i].label %> + <%= jsonArray[i].confidence %> + <%= jsonArray[i].create_at %> + + <%}}else{%> nan nan nan nan - <%}else{%> - <%for(var i=0; i < Object.keys(jsonArray.labels).length; i++){%> - - - - <%= jsonArray.labels[i].LabelName %> - - - <%= jsonArray.labels[i].confidence %> - - <%}}%> + <%}%> diff --git a/CitySecurity/app_server/view/login.ejs b/CitySecurity/app_server/view/login.ejs index 51c516f..d14657f 100644 --- a/CitySecurity/app_server/view/login.ejs +++ b/CitySecurity/app_server/view/login.ejs @@ -1,62 +1,48 @@ - - - - City Security System - - - - - - - - -
- -
-
- -
-
Giriş Paneli
-
-
-
-
- ...
-
-
- - -
-
- - + + + + + + + + +
+
+
+ +
+
+ - -
-

<%=hata%>

-
- - - -
- +
+
+
-
-
- - - - -
- - - - + \ No newline at end of file diff --git a/CitySecurity/app_server/view/newMonitoring.ejs b/CitySecurity/app_server/view/newMonitoring.ejs index 319f314..b068e00 100644 --- a/CitySecurity/app_server/view/newMonitoring.ejs +++ b/CitySecurity/app_server/view/newMonitoring.ejs @@ -6,7 +6,9 @@
- --> +
@@ -17,23 +19,23 @@

All List
-

- -
- +
- + + + + - <%if(jsonArray=="null"){%> @@ -43,25 +45,49 @@ <%}else{%> + <%for(var i=0; i < Object.keys(jsonArray.labels).length; i++){%> - + <%if(jsonArray.labels[i].danger == "danger"){%> + + + + + + + + + + + <%}else{%> + + + + + + <%}%> + + + + <%}}%>
Name LabelLabel Category ConfidenceDANGER
nan
mts<%= jsonArray.labels[i].LabelName %> <%= jsonArray.labels[i].confidence %><%= jsonArray.labels[i].danger %>
mts<%= jsonArray.labels[i].LabelName %> <%= jsonArray.labels[i].confidence %><%= jsonArray.labels[i].danger %>
+
-
+ + <%- include('footer') -%> \ No newline at end of file diff --git a/CitySecurity/index.html b/CitySecurity/index.html deleted file mode 100644 index 192179d..0000000 --- a/CitySecurity/index.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - Responsive Sidebar Navigation | CodyHouse - - -
-
- -
- - - - - - -
- -
- - -
-
-

Responsive Sidebar Navigation

-

👈Article & Download

-
-
-
- - - - - \ No newline at end of file diff --git a/CitySecurity/json.js b/CitySecurity/json.js deleted file mode 100644 index 2e88f51..0000000 --- a/CitySecurity/json.js +++ /dev/null @@ -1,44 +0,0 @@ - -var jso = { - - "labels": [ - { - "LabelName": "kitten", - "confidence": "0.3615228831768036" - }, - { - "LabelName": "cat", - "confidence": "0.997473955154419" - }, - { - "LabelName": "whiskers", - "confidence": "0.3001704514026642" - }, - { - "LabelName": "animal", - "confidence": "0.9441419243812561" - }, - { - "LabelName": "pet", - "confidence": "0.8389395475387573" - }, - { - "LabelName": "tabby cat", - "confidence": "0.30844953656196594" - }, - { - "LabelName": "small to medium sized cats", - "confidence": "0.7987512946128845" - }, - { - "LabelName": "maine coon", - "confidence": "0.32171761989593506" - } - ] -} - - -var jsonVeri = JSON.stringify(jso); -var veri = JSON.parse(jsonVeri); - -console.log(veri.labels[0].confidence); \ No newline at end of file diff --git a/CitySecurity/public/assets/css/style.css b/CitySecurity/public/assets/css/style.css index e7659f9..ea98354 100644 --- a/CitySecurity/public/assets/css/style.css +++ b/CitySecurity/public/assets/css/style.css @@ -16,21 +16,25 @@ body { background-color: white; width: 300px; margin:0 auto; - padding: 60px 40px 40px 40px; + padding: 40px 40px 40px 40px; animation: fade-in 1s ease-in 0s 1 alternate; } - -.loginanel:hover { - box-shadow: 0 0 50px rgba(1, 1, 1, .3); +#dangerColorRow{ + background-color: red; + } + + .login-panel:hover { + box-shadow: 0 0 50px rgba(1, 1, 1, .3); + } - .panel-title h1 { - font-size: 25px; - display: block; - border-bottom:1px solid #E4E4E4; - color: #888; - } + .panel-title h1 { + font-size: 25px; + display: block; + border-bottom:1px solid #E4E4E4; + color: #888; + } /* Toggle Styles */ @@ -103,15 +107,20 @@ body { #sidebar .nav a i{ margin-right: 16px; } + + .input-group{ + float: right; + } + + .input-group:hover { + box-shadow: 0 0 50px rgba(1, 1, 1, .3); + } + #kullanici{ margin-top: 15px; margin-right: 20px; color: rgb(64, 64, 175); } -.input-group{ - float: right; - padding-right: 15px; -} table{ margin-top: 50px; } @@ -119,4 +128,20 @@ table{ margin-top: 20px; margin-bottom: -20px; -} \ No newline at end of file +} + +.imgSmart { + width: 100%; + height: auto; + padding-bottom: 30px; +} +.contact-content img{ + border-radius: 100px; align-content: center; +} + +.aboutBaslik{ + font-weight: bold; + font-size: 40px; + +} + diff --git a/CitySecurity/public/assets/resim/Gelecekte.png b/CitySecurity/public/assets/resim/Gelecekte.png new file mode 100644 index 0000000..ba9a2ff Binary files /dev/null and b/CitySecurity/public/assets/resim/Gelecekte.png differ diff --git a/CitySecurity/public/assets/resim/Smart.jpg b/CitySecurity/public/assets/resim/Smart.jpg new file mode 100644 index 0000000..c9ff1bc Binary files /dev/null and b/CitySecurity/public/assets/resim/Smart.jpg differ diff --git a/CitySecurity/public/assets/resim/avatars/Bahar.jpeg b/CitySecurity/public/assets/resim/avatars/Bahar.jpeg new file mode 100644 index 0000000..d4f0a69 Binary files /dev/null and b/CitySecurity/public/assets/resim/avatars/Bahar.jpeg differ diff --git a/CitySecurity/public/assets/resim/avatars/Berkan.jpeg b/CitySecurity/public/assets/resim/avatars/Berkan.jpeg new file mode 100644 index 0000000..64d7aa0 Binary files /dev/null and b/CitySecurity/public/assets/resim/avatars/Berkan.jpeg differ diff --git a/CitySecurity/public/assets/resim/avatars/Meral.jpeg b/CitySecurity/public/assets/resim/avatars/Meral.jpeg new file mode 100644 index 0000000..f0cd582 Binary files /dev/null and b/CitySecurity/public/assets/resim/avatars/Meral.jpeg differ diff --git a/CitySecurity/public/assets/resim/avatars/Taha.jpeg b/CitySecurity/public/assets/resim/avatars/Taha.jpeg new file mode 100644 index 0000000..b2fccd5 Binary files /dev/null and b/CitySecurity/public/assets/resim/avatars/Taha.jpeg differ diff --git a/CitySecurity/public/assets/resim/avatars/Zisan.jpeg b/CitySecurity/public/assets/resim/avatars/Zisan.jpeg new file mode 100644 index 0000000..4e34913 Binary files /dev/null and b/CitySecurity/public/assets/resim/avatars/Zisan.jpeg differ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..48e341a --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3 @@ +{ + "lockfileVersion": 1 +}