aboutsummaryrefslogtreecommitdiffstats
path: root/solo_tool.py
diff options
context:
space:
mode:
Diffstat (limited to 'solo_tool.py')
-rw-r--r--solo_tool.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/solo_tool.py b/solo_tool.py
index bca5146..fee7e4a 100644
--- a/solo_tool.py
+++ b/solo_tool.py
@@ -30,13 +30,22 @@ class SoloTool:
self._sessionManager.addSong(path)
def setSong(self, index):
+ changed = index != self._playlist.getCurrentSongIndex()
self._playlist.setCurrentSong(index)
+ if changed:
+ self._notifier.notify(Notifier.CURRENT_SONG_EVENT)
def nextSong(self):
+ previous = self._playlist.getCurrentSongIndex()
self._playlist.nextSong()
+ if previous != self._playlist.getCurrentSongIndex():
+ self._notifier.notify(Notifier.CURRENT_SONG_EVENT)
def previousSong(self):
+ previous = self._playlist.getCurrentSongIndex()
self._playlist.previousSong()
+ if previous != self._playlist.getCurrentSongIndex():
+ self._notifier.notify(Notifier.CURRENT_SONG_EVENT)
def getSongs(self):
return self._playlist.getSongs()
@@ -45,7 +54,10 @@ class SoloTool:
self._abController.storeLimits(aLimit, bLimit)
def loadAbLimits(self, index):
+ changed = index != self._abController.getLoadedIndex()
self._abController.loadLimits(index)
+ if changed:
+ self._notifier.notify(Notifier.CURRENT_AB_EVENT)
def setAbLimits(self, aLimit, bLimit):
self._abController.setLimits(aLimit, bLimit)
@@ -61,10 +73,16 @@ class SoloTool:
self._abController.setEnable(enable)
def nextStoredAbLimits(self):
+ previous = self._abController.getLoadedIndex()
self._abController.nextStoredAbLimits()
+ if previous != self._abController.getLoadedIndex():
+ self._notifier.notify(Notifier.CURRENT_AB_EVENT)
def previousStoredAbLimits(self):
+ previous = self._abController.getLoadedIndex()
self._abController.previousStoredAbLimits()
+ if previous != self._abController.getLoadedIndex():
+ self._notifier.notify(Notifier.CURRENT_AB_EVENT)
def jumpToA(self):
a = self._abController.getCurrentLimits()[0]
@@ -121,3 +139,9 @@ class SoloTool:
def registerPlaybackRateCallback(self, callback):
self._notifier.registerCallback(Notifier.PLAYBACK_RATE_EVENT, callback)
+ def registerCurrentSongCallback(self, callback):
+ self._notifier.registerCallback(Notifier.CURRENT_SONG_EVENT, callback)
+
+ def registerCurrentAbLimitsCallback(self, callback):
+ self._notifier.registerCallback(Notifier.CURRENT_AB_EVENT, callback)
+