aboutsummaryrefslogtreecommitdiffstats
path: root/solo_tool.py
diff options
context:
space:
mode:
Diffstat (limited to 'solo_tool.py')
-rw-r--r--solo_tool.py41
1 files changed, 24 insertions, 17 deletions
diff --git a/solo_tool.py b/solo_tool.py
index fee7e4a..4ea081d 100644
--- a/solo_tool.py
+++ b/solo_tool.py
@@ -30,22 +30,25 @@ class SoloTool:
self._sessionManager.addSong(path)
def setSong(self, index):
- changed = index != self._playlist.getCurrentSongIndex()
+ previous = self._playlist.getCurrentSongIndex()
self._playlist.setCurrentSong(index)
- if changed:
- self._notifier.notify(Notifier.CURRENT_SONG_EVENT)
+ new = self._playlist.getCurrentSongIndex()
+ if previous != new:
+ self._notifier.notify(Notifier.CURRENT_SONG_EVENT, new)
def nextSong(self):
previous = self._playlist.getCurrentSongIndex()
self._playlist.nextSong()
- if previous != self._playlist.getCurrentSongIndex():
- self._notifier.notify(Notifier.CURRENT_SONG_EVENT)
+ new = self._playlist.getCurrentSongIndex()
+ if previous != new:
+ self._notifier.notify(Notifier.CURRENT_SONG_EVENT, new)
def previousSong(self):
previous = self._playlist.getCurrentSongIndex()
self._playlist.previousSong()
- if previous != self._playlist.getCurrentSongIndex():
- self._notifier.notify(Notifier.CURRENT_SONG_EVENT)
+ new = self._playlist.getCurrentSongIndex()
+ if previous != new:
+ self._notifier.notify(Notifier.CURRENT_SONG_EVENT, new)
def getSongs(self):
return self._playlist.getSongs()
@@ -54,10 +57,11 @@ class SoloTool:
self._abController.storeLimits(aLimit, bLimit)
def loadAbLimits(self, index):
- changed = index != self._abController.getLoadedIndex()
+ previous = self._abController.getLoadedIndex()
self._abController.loadLimits(index)
- if changed:
- self._notifier.notify(Notifier.CURRENT_AB_EVENT)
+ new = self._abController.getLoadedIndex()
+ if previous != new:
+ self._notifier.notify(Notifier.CURRENT_AB_EVENT, new)
def setAbLimits(self, aLimit, bLimit):
self._abController.setLimits(aLimit, bLimit)
@@ -75,14 +79,16 @@ class SoloTool:
def nextStoredAbLimits(self):
previous = self._abController.getLoadedIndex()
self._abController.nextStoredAbLimits()
- if previous != self._abController.getLoadedIndex():
- self._notifier.notify(Notifier.CURRENT_AB_EVENT)
+ new = self._abController.getLoadedIndex()
+ if previous != new:
+ self._notifier.notify(Notifier.CURRENT_AB_EVENT, new)
def previousStoredAbLimits(self):
previous = self._abController.getLoadedIndex()
self._abController.previousStoredAbLimits()
- if previous != self._abController.getLoadedIndex():
- self._notifier.notify(Notifier.CURRENT_AB_EVENT)
+ new = self._abController.getLoadedIndex()
+ if previous != new:
+ self._notifier.notify(Notifier.CURRENT_AB_EVENT, new)
def jumpToA(self):
a = self._abController.getCurrentLimits()[0]
@@ -110,10 +116,11 @@ class SoloTool:
return self._player.isPlaying()
def setPlaybackRate(self, rate):
- previousRate = self._player.getPlaybackRate()
+ previous = self._player.getPlaybackRate()
self._player.setPlaybackRate(rate)
- if previousRate != rate:
- self._notifier.notify(Notifier.PLAYBACK_RATE_EVENT)
+ new = self._player.getPlaybackRate()
+ if previous != new:
+ self._notifier.notify(Notifier.PLAYBACK_RATE_EVENT, new)
def getPlaybackRate(self):
return self._player.getPlaybackRate()