Compare commits
2 Commits
f57dfcfaf7
...
546795c2b6
Author | SHA1 | Date | |
---|---|---|---|
546795c2b6 | |||
2a3b48860d |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
camera.json
|
camera.json
|
||||||
|
__pycache__
|
||||||
|
|
17
server.py
17
server.py
|
@ -76,10 +76,10 @@ class ControlQueue:
|
||||||
self._worker = threading.Thread(target=self.worker)
|
self._worker = threading.Thread(target=self.worker)
|
||||||
self._worker.start()
|
self._worker.start()
|
||||||
|
|
||||||
def put(self, filename):
|
def put(self, command):
|
||||||
if self.q.empty():
|
if self.q.empty():
|
||||||
self.camera.abort = False
|
self.camera.abort = False
|
||||||
self.q.put(filename)
|
self.q.put(command)
|
||||||
|
|
||||||
def join(self):
|
def join(self):
|
||||||
self.shutdown = True
|
self.shutdown = True
|
||||||
|
@ -120,6 +120,18 @@ class API(object):
|
||||||
json.dump(data, fd, indent=4)
|
json.dump(data, fd, indent=4)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def move(self, **data):
|
||||||
|
result = {}
|
||||||
|
if data.get('direction') in (
|
||||||
|
'LEFT', 'RIGHT', 'UP', 'DOWN',
|
||||||
|
'LEFT_UP', 'LEFT_DOWN',
|
||||||
|
'RIGHT_UP', 'RIGHT_DOWN',
|
||||||
|
'IN', 'OUT',
|
||||||
|
):
|
||||||
|
direction = getattr(ctl.camera, data['direction'])
|
||||||
|
ctl.camera.momentary(direction, float(data.get('duration', 1)))
|
||||||
|
return result
|
||||||
|
|
||||||
def stop(self, **data):
|
def stop(self, **data):
|
||||||
result = {}
|
result = {}
|
||||||
ctl.camera.abort = True
|
ctl.camera.abort = True
|
||||||
|
@ -208,6 +220,7 @@ def main():
|
||||||
'gzip': True,
|
'gzip': True,
|
||||||
}
|
}
|
||||||
app = Application(handlers, **options)
|
app = Application(handlers, **options)
|
||||||
|
print('listening on http://%s:%s/' % (ADDRESS, PORT))
|
||||||
app.listen(PORT, ADDRESS)
|
app.listen(PORT, ADDRESS)
|
||||||
|
|
||||||
main = IOLoop.instance()
|
main = IOLoop.instance()
|
||||||
|
|
|
@ -662,5 +662,4 @@ function init_shift() {
|
||||||
updateShiftStatus()
|
updateShiftStatus()
|
||||||
setInterval(updateShiftStatus, 5000)
|
setInterval(updateShiftStatus, 5000)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user