diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-01-03 20:29:51 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-01-03 20:29:51 +0100 |
commit | 6b23d5fef7ab1a936e133d620bd277274882b3a7 (patch) | |
tree | 063abde114b678bbf64dbe042ef50483c7a2a164 /notifier.py | |
parent | bfa2abe556269de927e399a0547b18126a78ff96 (diff) |
Added playing state callback to player, refactored notifier to use it
Diffstat (limited to 'notifier.py')
-rw-r--r-- | notifier.py | 7 |
1 files changed, 6 insertions, 1 deletions
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) |