From 8fcffaf3391a51885601ffd23906855a883634c9 Mon Sep 17 00:00:00 2001 From: LASER-Yi Date: Sun, 9 May 2021 02:17:07 +0800 Subject: [PATCH] Add some interfaces in backend to send message and progress --- bazarr/event_handler.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bazarr/event_handler.py b/bazarr/event_handler.py index e03e22ede..5c7d54691 100644 --- a/bazarr/event_handler.py +++ b/bazarr/event_handler.py @@ -17,3 +17,15 @@ def event_stream(type, action="update", payload=None): except (ValueError, TypeError): pass socketio.emit("data", {"type": type, "action": action, "payload": payload}) + + +def show_message(msg): + event_stream(type="message", payload=msg) + + +def show_progress(name, percent): + event_stream(type="progress", payload={"name": name, "percent": percent}) + + +def hide_progress(name): + event_stream(type="progress", action="delete", payload={"name": name, "percent": 0})