From 8bd6d5092e25f320f3029713a135db94bf45f69d Mon Sep 17 00:00:00 2001 From: Johannes Knutsen Date: Sat, 26 Dec 2009 02:21:47 +0100 Subject: [PATCH] added song and songid to status and handling of prev/next commands --- mopidy/handler.py | 10 ++++++---- tests/handlertest.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mopidy/handler.py b/mopidy/handler.py index 07199e3d..823f9a0c 100644 --- a/mopidy/handler.py +++ b/mopidy/handler.py @@ -167,7 +167,7 @@ class MpdHandler(object): @register(r'^next$') def _next(self): - pass # TODO + return self.backend.next() @register(r'^password "(?P[^"]+)"$') def _password(self, password): @@ -212,9 +212,9 @@ class MpdHandler(object): def _playlistfind(self, tag, needle): pass # TODO - @register(r'^playlistid( (?P\S+))*$') + @register(r'^playlistid( "(?P\S+)")*$') def _playlistid(self, songid=None): - pass # TODO + return self.backend.playlist_info(songid, None, None) @register(r'^playlistinfo( "((?P\d+)|(?P\d+):(?P\d+)*)")*$') def _playlistinfo(self, songpos=None, start=None, end=None): @@ -238,7 +238,7 @@ class MpdHandler(object): @register(r'^previous$') def _previous(self): - pass # TODO + return self.backend.previous() @register(r'^rename (?P\S+) (?P\S+)$') def _rename(self, old_name, new_name): @@ -342,6 +342,8 @@ class MpdHandler(object): ('playlistlength', self.backend.status_playlist_length()), ('xfade', self.backend.status_xfade()), ('state', self.backend.status_state()), + ('song', self.backend.status_song_id()), + ('songid', self.backend.status_song_id()), ] @register(r'^swap (?P\d+) (?P\d+)$') diff --git a/tests/handlertest.py b/tests/handlertest.py index 4360dd2a..5ee0f2b3 100644 --- a/tests/handlertest.py +++ b/tests/handlertest.py @@ -312,7 +312,7 @@ class CurrentPlaylistHandlerTest(unittest.TestCase): self.assert_(result is None) def test_playlistid_with_songid(self): - result = self.h.handle_request(u'playlistid 10') + result = self.h.handle_request(u'playlistid "10"') self.assert_(result is None) def test_playlistinfo_without_songpos_or_range(self):