diff options
author | Anton Khirnov <anton@khirnov.net> | 2010-11-03 08:11:57 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2010-11-03 08:11:57 +0100 |
commit | b1fe053de2e2d8d7014f50dd2d1125583a393852 (patch) | |
tree | 2d159c14c4ef8b0752dcdf4d5573f1a6703398d3 /nephilim | |
parent | f049cec3b4140aa0e65385dfc87f54c06d5c5385 (diff) |
mpclient: new signal that's emitted when current song's position changes
Diffstat (limited to 'nephilim')
-rw-r--r-- | nephilim/mpclient.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/nephilim/mpclient.py b/nephilim/mpclient.py index 8badbcb..5263ccd 100644 --- a/nephilim/mpclient.py +++ b/nephilim/mpclient.py @@ -109,6 +109,7 @@ class MPClient(QtCore.QObject): db_updated = Signal() time_changed = Signal(int) song_changed = Signal(object) + songpos_changed = Signal(object) # this one's emitted when only current song's position changed state_changed = Signal(str) volume_changed = Signal(int) repeat_changed = Signal(bool) @@ -460,6 +461,7 @@ class MPClient(QtCore.QObject): pass if 'playlist' in subsystems: self.playlist_changed.emit() + self._command('currentsong', callback = self._update_cur_song) if 'output' in subsystems: self._command('outputs', callback = self._update_outputs) @@ -508,11 +510,15 @@ class MPClient(QtCore.QObject): self._command('currentsong', callback = self._update_cur_song) def _update_cur_song(self, data): + song = self.cur_song try: self.cur_song = Song(list(self._parse_objects(data, ''))[0]) except IndexError: self.cur_song = Song() - self.song_changed.emit(self.cur_song) + if song['id'] != self.cur_song['id']: + self.song_changed.emit(self.cur_song) + else: + self.songpos_changed.emit(self.cur_song) def _command(self, *cmd, **kwargs): """ |