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 :