summaryrefslogtreecommitdiff
path: root/clMonty.py
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-01-04 15:12:07 +0100
committerAnton Khirnov <wyskas@gmail.com>2009-01-04 15:12:07 +0100
commit97ad9bd8f460b74358f0a8e8c8f904425f25415c (patch)
tree3dff32672eaa718c6cd9addc8da27cc12ff95663 /clMonty.py
parent07e7b7e5e058cf074ff185b28e1730af2b4d392b (diff)
Remove occurrences of "empty song".
Diffstat (limited to 'clMonty.py')
-rw-r--r--clMonty.py26
1 files changed, 15 insertions, 11 deletions
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: