You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/bazarr/event_handler.py

20 lines
511 B

# coding=utf-8
from app import socketio
def event_stream(type, action="update", payload=None):
"""
:param type: The type of element.
:type type: str
:param action: The action type of element from update and delete.
:type action: str
:param payload: The payload to send, can be anything
"""
try:
payload = int(payload)
except (ValueError, TypeError):
pass
socketio.emit("data", {"type": type, "action": action, "payload": payload})