added status time
This commit is contained in:
parent
46bc8798f8
commit
148d3c55a2
@ -34,12 +34,15 @@ class BaseBackend(object):
|
|||||||
def status_playlist_length(self):
|
def status_playlist_length(self):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def status_xfade(self):
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def status_state(self):
|
def status_state(self):
|
||||||
return self.state
|
return self.state
|
||||||
|
|
||||||
|
def status_time(self):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def status_xfade(self):
|
||||||
|
return 0
|
||||||
|
|
||||||
# Control methods
|
# Control methods
|
||||||
def next(self):
|
def next(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -143,7 +143,7 @@ class SpotifyBackend(BaseBackend):
|
|||||||
def current_song(self):
|
def current_song(self):
|
||||||
try:
|
try:
|
||||||
track = self._current_playlist[self._current_song_id]
|
track = self._current_playlist[self._current_song_id]
|
||||||
return self._format_track(track)
|
return self._format_track(track, self._current_song_id)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -187,5 +187,11 @@ class SpotifyBackend(BaseBackend):
|
|||||||
def status_song_id(self):
|
def status_song_id(self):
|
||||||
return self._current_song_id
|
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):
|
def url_handlers(self):
|
||||||
return [u'spotify:', u'http://open.spotify.com/']
|
return [u'spotify:', u'http://open.spotify.com/']
|
||||||
|
|||||||
@ -385,6 +385,7 @@ class MpdHandler(object):
|
|||||||
('state', self.backend.status_state()),
|
('state', self.backend.status_state()),
|
||||||
('song', self.backend.status_song_id()),
|
('song', self.backend.status_song_id()),
|
||||||
('songid', 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+)$')
|
@register(r'^swap (?P<songpos1>\d+) (?P<songpos2>\d+)$')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user