modifié: superTornado.py
modifié: v/video.html
This commit is contained in:
parent
08212e08fd
commit
589f65d4bb
@ -26,6 +26,8 @@ portCamera = ""
|
|||||||
portServ =""
|
portServ =""
|
||||||
log = Log()
|
log = Log()
|
||||||
urlCamera=""
|
urlCamera=""
|
||||||
|
urlSocket=""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class BaseHandler(tornado.web.RequestHandler):
|
class BaseHandler(tornado.web.RequestHandler):
|
||||||
@ -35,7 +37,8 @@ class BaseHandler(tornado.web.RequestHandler):
|
|||||||
|
|
||||||
class MainHandler(BaseHandler):
|
class MainHandler(BaseHandler):
|
||||||
def get(self):
|
def get(self):
|
||||||
self.render("v/index.html")
|
urlSocket = 'ws://'+socket.getaddrinfo(socket.gethostname(), None)':'+portCamera+'/socket'
|
||||||
|
self.render("v/index.html", url=urlSocket)
|
||||||
|
|
||||||
def post(self):
|
def post(self):
|
||||||
iden = self.get_argument("id","")
|
iden = self.get_argument("id","")
|
||||||
@ -177,7 +180,6 @@ if __name__ == "__main__":
|
|||||||
urlCamera = 'http://test:a@'+ipCamera+':'+portCamera+'/image.jpg?cidx=791836195'
|
urlCamera = 'http://test:a@'+ipCamera+':'+portCamera+'/image.jpg?cidx=791836195'
|
||||||
log.printL("->Ping camera ...",lvl.INFO)
|
log.printL("->Ping camera ...",lvl.INFO)
|
||||||
try :
|
try :
|
||||||
socket.setdefaulttimeout(30)
|
|
||||||
f = urlopen(urlCamera)
|
f = urlopen(urlCamera)
|
||||||
log.printL( "->Camera OK ", lvl.SUCCESS)
|
log.printL( "->Camera OK ", lvl.SUCCESS)
|
||||||
except Exception, e :
|
except Exception, e :
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<title>Acces camera</title>
|
<title>Acces camera</title>
|
||||||
<script src="js/jquery-2.1.0.min.js"></script>
|
<script src="js/jquery-2.1.0.min.js"></script>
|
||||||
<script >
|
<script >
|
||||||
var ws = new WebSocket ("ws://192.168.1.12/socket");
|
var ws = new WebSocket ("{{ url }}/");
|
||||||
ws.onmessage = function (evt) {
|
ws.onmessage = function (evt) {
|
||||||
console.log("data receive");
|
console.log("data receive");
|
||||||
if(evt.data != "error") {
|
if(evt.data != "error") {
|
||||||
|
Reference in New Issue
Block a user