From 6b23d5fef7ab1a936e133d620bd277274882b3a7 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Mon, 3 Jan 2022 20:29:51 +0100 Subject: Added playing state callback to player, refactored notifier to use it --- notifier.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'notifier.py') diff --git a/notifier.py b/notifier.py index 1a68c56..e052b5c 100644 --- a/notifier.py +++ b/notifier.py @@ -2,8 +2,10 @@ class Notifier: PLAYING_STATE_EVENT = 0 - def __init__(self): + def __init__(self, player): self._callbacks = dict() + self._player = player + self._player.setPlayingStateChangedCallback(self._playingStateChangedCallback) def registerCallback(self, event, callback): if event not in self._callbacks: @@ -13,3 +15,6 @@ class Notifier: def notify(self, event): for callback in self._callbacks.get(event, list()): callback() + + def _playingStateChangedCallback(self, *args): + self.notify(Notifier.PLAYING_STATE_EVENT) -- cgit v1.2.3