Split statuses in to separate methods in the backend

This commit is contained in:
Johannes Knutsen 2009-12-24 00:26:46 +01:00
parent df2381815c
commit a00f9d9834
2 changed files with 37 additions and 13 deletions

View File

@ -9,15 +9,29 @@ class BaseBackend(object):
def playlist_changes(self, version): def playlist_changes(self, version):
return None return None
def status(self): def status_volume(self):
return { return 0
'volume': 0,
'repeat': 0, def status_repeat(self):
'random': 0, return 0
'single': 0,
'consume': 0, def status_random(self):
'playlist': 0, return 0
'playlistlength': 0,
'xfade': 0, def status_single(self):
'state': 'stop', return 0
}
def status_consume(self):
return 0
def status_playlist(self):
return 0
def status_playlist_length(self):
return 0
def status_xfade(self):
return 0
def status_state(self):
return 'stop'

View File

@ -58,4 +58,14 @@ class MpdHandler(object):
@register(r'^status$') @register(r'^status$')
def _status(self): def _status(self):
return self.backend.status() return {
'volume': self.backend.status_volume(),
'repeat': self.backend.status_repeat(),
'random': self.backend.status_random(),
'single': self.backend.status_single(),
'consume': self.backend.status_consume(),
'playlist': self.backend.status_playlist(),
'playlistlength': self.backend.status_playlist_length(),
'xfade': self.backend.status_xfade(),
'state': self.backend.status_state(),
}