added status time

This commit is contained in:
Johannes Knutsen 2009-12-26 03:35:10 +01:00
parent 46bc8798f8
commit 148d3c55a2
3 changed files with 14 additions and 4 deletions

View File

@ -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

View File

@ -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/']

View File

@ -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<songpos1>\d+) (?P<songpos2>\d+)$')