From 97ad9bd8f460b74358f0a8e8c8f904425f25415c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 4 Jan 2009 15:12:07 +0100 Subject: Remove occurrences of "empty song". --- clMonty.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'clMonty.py') diff --git a/clMonty.py b/clMonty.py index b2d35df..3abbb96 100644 --- a/clMonty.py +++ b/clMonty.py @@ -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: -- cgit v1.2.3