diff options
-rw-r--r-- | clMonty.py | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -241,10 +241,11 @@ class Monty(QtCore.QObject): ) def _updateCurrentSong(self): """Update the current song.""" - self._curSong=self._retrieve(self._client.currentsong) - if self._curSong==None: - return - self._curSong=Song(self._curSong) + song = self._retrieve(self._client.currentsong) + if not song: + self._curSong = None + else: + self._curSong = Song(song) class simpleThread(Thread): callback=None @@ -275,19 +276,22 @@ class Monty(QtCore.QObject): except: self._curSong=None - song=self._curSong - if song==None or status==None: + if status == None: self._client=None self._raiseEvent('onDisconnect', None) self.killTimer(self._timerID) return " check if song has changed" - if song.getID()>=0: - curID=song.getID() - if curID!=self._curSongID: - self._raiseEvent('onSongChange', {'oldSongID':self._curSongID, 'newSongID':curID}) - self._curSongID=curID + song = self._curSong + if song: + curID = song.getID() + else: + curID = -1 + + if curID != self._curSongID: + self._raiseEvent('onSongChange', {'oldSongID':self._curSongID, 'newSongID':curID}) + self._curSongID = curID " check if the time has changed" if 'time' in status: |