From af23a6e85a29ef2535cb439328a51e4b6f6d6b2c Mon Sep 17 00:00:00 2001 From: sidya82 Date: Mon, 3 Mar 2014 21:49:12 +0100 Subject: [PATCH] =?UTF-8?q?=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20m/fi?= =?UTF-8?q?chier/conf=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20m/loadC?= =?UTF-8?q?onf.py=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20superTornad?= =?UTF-8?q?o.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- m/fichier/conf | 1 + m/loadConf.py | 3 +++ superTornado.py | 11 +++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/m/fichier/conf b/m/fichier/conf index 02f3e92..9012162 100644 --- a/m/fichier/conf +++ b/m/fichier/conf @@ -1,4 +1,5 @@ blind=1 camera=192.168.1.13 portCamera=80 +serv=192.168.1.12 portServ=80 diff --git a/m/loadConf.py b/m/loadConf.py index 838cf96..70297c6 100644 --- a/m/loadConf.py +++ b/m/loadConf.py @@ -24,6 +24,9 @@ class LoadConf(object): def portCamera(self) : return self.loadValue("portCamera") + def ipServ(self) : + return self.loadValue("serv") + def portServ(self) : return self.loadValue("portServ") diff --git a/superTornado.py b/superTornado.py index ae4dffb..8673e49 100644 --- a/superTornado.py +++ b/superTornado.py @@ -37,8 +37,7 @@ class BaseHandler(tornado.web.RequestHandler): class MainHandler(BaseHandler): def get(self): - urlSocket = 'ws://'+socket.getaddrinfo(socket.gethostname(), None)+':'+portCamera+'/socket' - self.render("v/index.html", url=urlSocket) + self.render("v/index.html") def post(self): iden = self.get_argument("id","") @@ -60,7 +59,7 @@ class VideoHandler(BaseHandler): if not self.current_user : self.redirect("/") return - self.render("v/video.html") + self.render("v/video.html", url=urlSocket) class UnauthorizedHandler(BaseHandler): def get(self): @@ -154,13 +153,16 @@ if __name__ == "__main__": blind = config.isBlind() ipCamera = config.ipCamera() portCamera = config.portCamera() + ipServ = config.ipServ() portServ = config.portServ() if blind == "error" : raise ConfigError("Failed Load Blind Configuration") if ipCamera == "error" : raise ConfigError("Failed Load IP Camera Configuration") if portCamera == "error" : - raise ConfigError("Failed Load IP Camera Configuration") + raise ConfigError("Failed Load Port Camera Configuration") + if ipServ == "error" : + raise ConfigError("Failed Load IP Server Configuration") if portServ == "error" : raise ConfigError("Failed Load Port Server Configuration") except ConfigError as e : @@ -177,6 +179,7 @@ if __name__ == "__main__": log.printL(" +Port Server : " + portServ,lvl.INFO) print "" + urlSocket = 'ws://'+ipServ':'+portCamera+'/socket' urlCamera = 'http://test:a@'+ipCamera+':'+portCamera+'/image.jpg?cidx=791836195' log.printL("->Ping camera ...",lvl.INFO) try :