aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--webserver.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/webserver.py b/webserver.py
index 41d1d30..a2b9b7a 100644
--- a/webserver.py
+++ b/webserver.py
@@ -40,7 +40,6 @@ BASENAME = f"{os.path.splitext(os.path.basename(__file__))[0]}"
LOGDIR = 'logs'
LOGFILE = os.path.join(LOGDIR, f"{BASENAME}.log")
LOGLEVEL = logging.INFO
-# LOGLEVEL = logging.DEBUG
# This should come from the config file:
VIDEO_DIR = os.path.join(CWD, "videos")
@@ -225,7 +224,6 @@ async def camera_route(websocket: WebSocket, client_id: str, camera_id: str) ->
async def send_frames():
while True:
- logger.debug("Getting from queue frame for '/ws/%s/%s'.", client_id, camera_id)
try:
# Don't wait indefinitely to allow checking for client disconnection:
frame_data = queue.get_nowait()
@@ -233,9 +231,7 @@ async def camera_route(websocket: WebSocket, client_id: str, camera_id: str) ->
await asyncio.sleep(0.1)
continue
try:
- logger.debug("Sending frame to '/ws/%s/%s'.", client_id, camera_id)
await websocket.send_bytes(frame_data)
- logger.debug("Sent frame to '/ws/%s/%s'.", client_id, camera_id)
# This exception is raised when client disconnects:
except Exception as exc:
logger.warning("Error sending frame to '/ws/%s/%s': %r", client_id, camera_id, exc)
@@ -246,15 +242,15 @@ async def camera_route(websocket: WebSocket, client_id: str, camera_id: str) ->
while True:
try:
data = await websocket.receive_text()
- logger.info("Received control message from '/ws/%s/%s': %s", client_id, camera_id, data)
+ logger.info("Received control message: %r from client_id: '%s', camera_id: '%s'.", data, client_id, camera_id)
# Handle control messages from the client:
frontend_message = json.loads(data)
for command, args in frontend_message.items():
if validate_directive(command, args, client_id, camera_id):
args_list = [str(arg).encode('utf-8') for arg in args]
- ctrl_msg_que.put_nowait((client_id, camera_id, command, args_list))
+ ctrl_msg_que.put_nowait((client_id.encode('utf-8'), camera_id.encode('utf-8'), command.encode('utf-8'), args_list))
logger.info(
- "Put control command '%s' with args: %r for '/ws/%s/%s' on queue to backend.",
+ "Put control command %r with args: %r for client_id: %r, camera_id: %r on queue to backend.",
command,
args_list,
client_id,