modifié: m/fichier/conf

modifié:         m/loadConf.py
	modifié:         superTornado.py
This commit is contained in:
sidya82 2014-03-18 11:51:14 +01:00
parent 34d8a7c6b3
commit dba3859ba8
3 changed files with 30 additions and 2 deletions

View File

@ -1,5 +1,8 @@
blind=1 blind=1
camera=192.168.1.13 camera=192.168.1.13
portCamera=80 portCamera=80
idCamera=test:a
endUrlCamera=image.jpg?cidx=791836195
serv=192.168.1.12 serv=192.168.1.12
portServ=80 portServ=80

View File

@ -55,6 +55,22 @@ class LoadConf(object):
def portServ(self) : def portServ(self) :
return self.loadValue("portServ") return self.loadValue("portServ")
"""
Return idCamera configuration
Else "error"
"""
def idCamera(self) :
return self.loadValue("idCamera")
"""
Return endUrlCamera configuration
Else "error"
"""
def endUrlCamera(self) :
return self.loadValue("endUrlCamera")
class ConfigError(Exception): class ConfigError(Exception):

View File

@ -30,9 +30,11 @@ class GlobalVars :
blind = False blind = False
ipCamera = "" ipCamera = ""
portCamera = "" portCamera = ""
endUrlCamera = ""
idCamera = ""
urlCamera = ""
portServ = "" portServ = ""
log = Log() log = Log()
urlCamera = ""
urlSocket = "" urlSocket = ""
authorized = 0 authorized = 0
unauthorized = 0 unauthorized = 0
@ -253,14 +255,21 @@ if __name__ == "__main__":
GlobalVars.blind = config.isBlind() GlobalVars.blind = config.isBlind()
GlobalVars.ipCamera = config.ipCamera() GlobalVars.ipCamera = config.ipCamera()
GlobalVars.portCamera = config.portCamera() GlobalVars.portCamera = config.portCamera()
GlobalVars.idCamera = config.idCamera()
GlobalVars.endUrlCamera = config.endUrlCamera()
GlobalVars.ipServ = config.ipServ() GlobalVars.ipServ = config.ipServ()
GlobalVars.portServ = config.portServ() GlobalVars.portServ = config.portServ()
if blind == "error" : if blind == "error" :
raise ConfigError("Failed Load Blind Configuration") raise ConfigError("Failed Load Blind Configuration")
if ipCamera == "error" : if ipCamera == "error" :
raise ConfigError("Failed Load IP Camera Configuration") raise ConfigError("Failed Load IP Camera Configuration")
if portCamera == "error" : if portCamera == "error" :
raise ConfigError("Failed Load Port Camera Configuration") raise ConfigError("Failed Load Port Camera Configuration")
if idCamera == "error" :
raise ConfigError("Failed Load ID Camera Configuration")
if endUrlCamera == "error" :
raise ConfigError("Failed Load ID Camera Configuration")
if ipServ == "error" : if ipServ == "error" :
raise ConfigError("Failed Load IP Server Configuration") raise ConfigError("Failed Load IP Server Configuration")
if portServ == "error" : if portServ == "error" :
@ -281,7 +290,7 @@ if __name__ == "__main__":
print "" print ""
GlobalVars.urlSocket = 'ws://'+GlobalVars.ipServ+':'+GlobalVars.portCamera+'/socket' GlobalVars.urlSocket = 'ws://'+GlobalVars.ipServ+':'+GlobalVars.portCamera+'/socket'
GlobalVars.urlCamera = 'http://test:a@'+GlobalVars.ipCamera+':'+GlobalVars.portCamera+'/image.jpg?cidx=791836195' GlobalVars.urlCamera = 'http://'+GlobalVars.idCamera+'@'+GlobalVars.ipCamera+':'+GlobalVars.portCamera+'/'+GlobalVars.endUrlCamera
log.printL("->Ping camera ...",lvl.INFO) log.printL("->Ping camera ...",lvl.INFO)
try : try :