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 /solo_tool.py | |
parent | bfa2abe556269de927e399a0547b18126a78ff96 (diff) |
Added playing state callback to player, refactored notifier to use it
Diffstat (limited to 'solo_tool.py')
-rw-r--r-- | solo_tool.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/solo_tool.py b/solo_tool.py index 5e3a1fd..f52e074 100644 --- a/solo_tool.py +++ b/solo_tool.py @@ -12,7 +12,7 @@ class SoloTool: self._playlist = Playlist(self._playlistCallback) self._abController = ABController(enabled=False, callback=self._abControllerCallback) self._sessionManager = SessionManager(self._playlist, self._abController) - self._notifier = Notifier() + self._notifier = Notifier(self._player) def _playlistCallback(self, path): self._player.setCurrentSong(path) @@ -80,19 +80,13 @@ class SoloTool: self._sessionManager.saveSession(f) def play(self): - self._playerCommand(self._player.play) + self._player.play() def pause(self): - self._playerCommand(self._player.pause) + self._player.pause() def stop(self): - self._playerCommand(self._player.stop) - - def _playerCommand(self, f): - playing = self.isPlaying() - f() - if playing != self.isPlaying(): - self._notifier.notify(Notifier.PLAYING_STATE_EVENT) + self._player.stop() def isPlaying(self): return self._player.isPlaying() |