From 951bf0fdb4f1d20ed5b7147f799d5d661a776c5d Mon Sep 17 00:00:00 2001 From: sidya82 Date: Sun, 2 Mar 2014 23:47:33 +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 | 6 ++++-- m/loadConf.py | 7 ++++++- superTornado.py | 25 ++++++++++++++----------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/m/fichier/conf b/m/fichier/conf index 4a6d12d..3aca630 100644 --- a/m/fichier/conf +++ b/m/fichier/conf @@ -1,3 +1,5 @@ - +blind=1 camera=192.168.1.13 -port=80 + +portServ=80 + diff --git a/m/loadConf.py b/m/loadConf.py index d9b0c58..c80f31d 100644 --- a/m/loadConf.py +++ b/m/loadConf.py @@ -21,8 +21,13 @@ class LoadConf(object): def ipCamera(self) : return self.loadValue("camera") + def portCamera(self) : + return self.loadValue("portCamera") + def portServ(self) : - return self.loadValue("port") + return self.loadValue("portServ") + + class bcolors: HEADER = '\033[95m' diff --git a/superTornado.py b/superTornado.py index 47b585b..67fa300 100644 --- a/superTornado.py +++ b/superTornado.py @@ -156,25 +156,28 @@ if __name__ == "__main__": print "->Loading configuration ... " try : blind = config.isBlind() - camera = config.ipCamera() - port = config.portServ() + ipCamera = config.ipCamera() + portCamera = config.portCamera()) + portServ = config.portServ() if blind == "error" : - raise "Failed Load Blind Configuration" - if camera == "error" : - raise "Failed Load IP Camera Configuration" - if port == "error" : - raise "Failed Load Port Server Configuration" + raise BlindConfigurationERROR(bcolors.FAIL +"Failed Load Blind Configuration") + if ipCamera == "error" : + raise IPCameraConfigurationERROR(bcolors.FAIL +"Failed Load IP Camera Configuration" + if portCamera == "error" : + raise PortCameraConfigurationERROR(bcolors.FAIL + "Failed Load IP Camera Configuration" + if portServ == "error" : + raise PortServ ConfigurationERROR(bcolors.FAIL + "Failed Load Port Server Configuration" except Exception, e : - print bcolors.WARNING + "Configuration Loading Failed ! Check Configuration File !" + bcolors.ENDC - print e + print "Configuration Loading Failed ! Check Configuration File !" + bcolors.ENDC + print bcolors.FAIL + e + bcolors.ENDC sys.exit(1) print "->Configuration Server Load Successfully :" if blind == True: print " ->Blind unhabitant" else : print " ->Not blind unhabitant" - print " ->Ip camera : " + camera - print " ->Port Server : " + port + print " ->Ip camera : " + ipCamera + print " ->Port Server : " + portServ tornado.options.parse_command_line() try :