modifié: superTornado.py
This commit is contained in:
parent
bb01e28ab0
commit
5600f1216d
@ -247,19 +247,28 @@ class WSocketHandler(BaseHandler,tornado.websocket.WebSocketHandler):
|
|||||||
Allow send the image in the websocket
|
Allow send the image in the websocket
|
||||||
"""
|
"""
|
||||||
try :
|
try :
|
||||||
temp = open("temp","w")
|
|
||||||
|
with open("temp","w") as temp :
|
||||||
socket.setdefaulttimeout(5)
|
socket.setdefaulttimeout(5)
|
||||||
f = urlopen(GlobalVars.urlCamera)
|
f = urlopen(GlobalVars.urlCamera)
|
||||||
|
temp.write(f.read())
|
||||||
|
temp.close()
|
||||||
|
with open("temp","r") as temp :
|
||||||
|
with open("temp2","w") as dest :
|
||||||
|
isData = False
|
||||||
|
for ligne in temp
|
||||||
|
ligne.rstrip('\r\n')
|
||||||
|
if data ="--MOTOBIX_Fast_Serverpush"
|
||||||
isData = False
|
isData = False
|
||||||
data = f.readline().rstrip('\r\n')
|
|
||||||
while(data != "--MOBOTIX_Fast_Serverpush--"):
|
|
||||||
data = f.readline().rstrip('\r\n')
|
|
||||||
if isData == True:
|
if isData == True:
|
||||||
temp.write(data)
|
dest.write(data+"\n")
|
||||||
if data == "ENDSECTIONEVENT" :
|
if data == "ENDSECTIONEVENT" :
|
||||||
isData = True
|
isData = True
|
||||||
data = f.read()
|
data = f.read()
|
||||||
encoded = base64.b64encode(data)
|
temp.close()
|
||||||
|
dest.close()
|
||||||
|
with open("temp2","r") as data :
|
||||||
|
encoded = base64.b64encode(data.read())
|
||||||
f.close()
|
f.close()
|
||||||
self.write_message(encoded)
|
self.write_message(encoded)
|
||||||
GlobalVars.log.printL( "->Image Data Send : " + self.request.remote_ip, lvl.INFO)
|
GlobalVars.log.printL( "->Image Data Send : " + self.request.remote_ip, lvl.INFO)
|
||||||
|
Reference in New Issue
Block a user