summaryrefslogtreecommitdiff
path: root/nephilim/mpclient.py
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-03-07 13:43:38 +0100
committerAnton Khirnov <wyskas@gmail.com>2009-03-07 13:43:38 +0100
commitfbd81bd6a5b9495fd29a91b345fb0555f1e7e176 (patch)
tree80422a2340a20aea3fbb7e30da6bd0521b12b6b8 /nephilim/mpclient.py
parentd827aded064c538eee0e96e4aebf97f19821b40c (diff)
mpclient: cleanup after previous commit.
Diffstat (limited to 'nephilim/mpclient.py')
-rw-r--r--nephilim/mpclient.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/nephilim/mpclient.py b/nephilim/mpclient.py
index c2a583b..148e1e5 100644
--- a/nephilim/mpclient.py
+++ b/nephilim/mpclient.py
@@ -13,7 +13,7 @@ class MPClient(QtCore.QObject):
_cur_lib = None
_cur_playlist = None
_cur_song = None
- _status = {'volume' : None, 'repeat' : None, 'random' : None,
+ _status = {'volume' : None, 'repeat' : None, 'random' : None, 'songid' : None,
'playlist' : None, 'playlistlength' : None, 'state' : None,
'time' : None, 'length' : None, 'xfade' : None, 'updatings_db' : None}
@@ -181,7 +181,7 @@ class MPClient(QtCore.QObject):
self._client.addid(path.encode('utf-8'))
ret = self._client.command_list_end()
self._update_playlist()
- if self._cur_state == 'stop':
+ if self._status['state'] == 'stop':
self.play(ret[0])
except mpd.CommandError:
logging.error('Cannot add some files, check permissions.')
@@ -244,6 +244,8 @@ class MPClient(QtCore.QObject):
if not 'updatings_db' in ret:
ret['updatings_db'] = 0
+ if not 'songid' in ret:
+ ret['songid'] = -1
return ret
def timerEvent(self, event):
@@ -257,17 +259,10 @@ class MPClient(QtCore.QObject):
self.killTimer(self._timer_id)
return
- # check if song has changed
self._update_current_song()
- song = self._cur_song
- if song:
- cur_id = song.getID()
- else:
- cur_id = -1
- if cur_id != self._cur_songid:
- self.emit(QtCore.SIGNAL('song_changed'), cur_id)
- self._cur_songid = cur_id
+ if self._status['songid'] != old_status['songid']:
+ self.emit(QtCore.SIGNAL('song_changed'), self._status['songid'])
if self._status['time'] != old_status['time']:
self.emit(QtCore.SIGNAL('time_changed'), self._status['time'])