]> kaliko git repositories - mpd-sima.git/blobdiff - sima/client.py
Huge commit… Running last.fm track mode
[mpd-sima.git] / sima / client.py
index 641fa22166f106ff2adfa32611223e783b091c71..9d6100535f93e880d1792ce4aa6c74847ecdfd69 100644 (file)
@@ -130,6 +130,11 @@ class PlayerClient(Player):
     def remove(self, position=0):
         self._client.delete(position)
 
+    def add(self, track):
+        """Overriding MPD's add method to accept add signature with a Track
+        object"""
+        self._client.add(track.file)
+
     @property
     def state(self):
         return str(self._client.status().get('state'))
@@ -138,6 +143,12 @@ class PlayerClient(Player):
     def current(self):
         return self.currentsong()
 
+    @property
+    def queue(self):
+        plst = self.playlist
+        plst.reverse()
+        return [ trk for trk in plst if int(trk.pos) > int(self.current.pos)]
+
     @property
     def playlist(self):
         """
@@ -178,7 +189,7 @@ class PlayerClient(Player):
                 raise PlayerError("Could not connect to '%s': "
                                   "error with password command: %s" %
                                   (self._host, err))
-        # Controls we have sufficient rights for MPD_sima
+        # Controls we have sufficient rights
         needed_cmds = ['status', 'stats', 'add', 'find', \
                        'search', 'currentsong', 'ping']