From 148d3c55a2193b1a42f44de5212ceff560987046 Mon Sep 17 00:00:00 2001 From: Johannes Knutsen Date: Sat, 26 Dec 2009 03:35:10 +0100 Subject: [PATCH] added status time --- mopidy/backends/base.py | 9 ++++++--- mopidy/backends/spotify.py | 8 +++++++- mopidy/handler.py | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mopidy/backends/base.py b/mopidy/backends/base.py index 3ae4713a..899c3923 100644 --- a/mopidy/backends/base.py +++ b/mopidy/backends/base.py @@ -34,12 +34,15 @@ class BaseBackend(object): def status_playlist_length(self): return 0 - def status_xfade(self): - return 0 - def status_state(self): return self.state + def status_time(self): + return 0 + + def status_xfade(self): + return 0 + # Control methods def next(self): pass diff --git a/mopidy/backends/spotify.py b/mopidy/backends/spotify.py index 4995359e..00083f75 100644 --- a/mopidy/backends/spotify.py +++ b/mopidy/backends/spotify.py @@ -143,7 +143,7 @@ class SpotifyBackend(BaseBackend): def current_song(self): try: track = self._current_playlist[self._current_song_id] - return self._format_track(track) + return self._format_track(track, self._current_song_id) except IndexError: return None @@ -187,5 +187,11 @@ class SpotifyBackend(BaseBackend): def status_song_id(self): return self._current_song_id + def status_time(self): + if self.state is self.PLAY: + return u'0:00' + else: + return None + def url_handlers(self): return [u'spotify:', u'http://open.spotify.com/'] diff --git a/mopidy/handler.py b/mopidy/handler.py index a96d7b89..3b625e64 100644 --- a/mopidy/handler.py +++ b/mopidy/handler.py @@ -385,6 +385,7 @@ class MpdHandler(object): ('state', self.backend.status_state()), ('song', self.backend.status_song_id()), ('songid', self.backend.status_song_id()), + ('time', self.backend.status_time()), ] @register(r'^swap (?P\d+) (?P\d+)$')