aboutsummaryrefslogtreecommitdiffstats
path: root/solo_tool.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-04 17:55:00 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-04 17:55:00 +0100
commit2b4323eca801638f0a305ff29afe815a45e103b1 (patch)
treed130038b86d671d78eb52e56ce8d2b9b3bd16842 /solo_tool.py
parentc4cb9a96342568890dcf1e36d02d6180bdb26ac8 (diff)
Added current value to notification system, fixed Qt hack
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()