forked from openlp/openlp
fix poll api for remotes
This commit is contained in:
parent
c6c7931323
commit
c5e761a153
@ -107,13 +107,15 @@ def index(request):
|
||||
return blank_endpoint.render_template('index.mako', **TRANSLATED_STRINGS)
|
||||
|
||||
|
||||
@blank_endpoint.route('api/poll')
|
||||
@blank_endpoint.route('poll')
|
||||
def poll(request):
|
||||
"""
|
||||
Deliver the page for the /poll url
|
||||
|
||||
:param request:
|
||||
"""
|
||||
return Registry().get('poller').raw_poll()
|
||||
return Registry().get('poller').poll()
|
||||
|
||||
|
||||
@blank_endpoint.route('api/display/{display:hide|show|blank|theme|desktop}')
|
||||
|
@ -53,7 +53,7 @@ class Poller(RegistryProperties):
|
||||
"""
|
||||
Poll OpenLP to determine the current slide number and item name.
|
||||
"""
|
||||
return json.dumps({'results': self.raw_poll()}).encode()
|
||||
return {'results': self.raw_poll()}
|
||||
|
||||
def main_poll(self):
|
||||
"""
|
||||
|
@ -27,6 +27,7 @@ with OpenLP. It uses JSON to communicate with the remotes.
|
||||
|
||||
import asyncio
|
||||
import websockets
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
|
||||
@ -130,7 +131,7 @@ class WebSocketServer(RegistryProperties, OpenLPMixin):
|
||||
while True:
|
||||
current_poll = poller.poll()
|
||||
if current_poll != previous_poll:
|
||||
yield from request.send(current_poll)
|
||||
yield from request.send(json.dumps(current_poll).encode())
|
||||
previous_poll = current_poll
|
||||
yield from asyncio.sleep(0.2)
|
||||
elif path == '/live_changed':
|
||||
|
Loading…
Reference in New Issue
Block a user