aboutsummaryrefslogtreecommitdiffstats
path: root/player_vlc.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-03 20:29:51 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-03 20:29:51 +0100
commit6b23d5fef7ab1a936e133d620bd277274882b3a7 (patch)
tree063abde114b678bbf64dbe042ef50483c7a2a164 /player_vlc.py
parentbfa2abe556269de927e399a0547b18126a78ff96 (diff)
Added playing state callback to player, refactored notifier to use it
Diffstat (limited to 'player_vlc.py')
-rw-r--r--player_vlc.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/player_vlc.py b/player_vlc.py
index c0eadf9..9f8bb56 100644
--- a/player_vlc.py
+++ b/player_vlc.py
@@ -38,3 +38,14 @@ class Player:
def setCurrentSong(self, path):
media = vlc.Media(path)
self._player.set_media(media)
+
+ def setPlayingStateChangedCallback(self, callback):
+ events = [
+ vlc.EventType.MediaPlayerStopped,
+ vlc.EventType.MediaPlayerPlaying,
+ vlc.EventType.MediaPlayerPaused
+ ]
+ manager = self._player.event_manager()
+ for e in events:
+ manager.event_attach(e, callback)
+ self._playingStateChangedCallback = callback