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 --- solo_tool.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'solo_tool.py') 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() -- cgit v1.2.3