aboutsummaryrefslogtreecommitdiffstats
path: root/notifier.py
blob: 1a68c56130b98e1619b3537405f266ef4aa0711e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Notifier:
    PLAYING_STATE_EVENT = 0

    def __init__(self):
        self._callbacks = dict()

    def registerCallback(self, event, callback):
        if event not in self._callbacks:
            self._callbacks[event] = list()
        self._callbacks[event].append(callback)

    def notify(self, event):
        for callback in self._callbacks.get(event, list()):
            callback()