From 01a6751ce69e5a078d3f3b89de67467258d62731 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 13 Feb 2010 20:11:42 +0100 Subject: [PATCH] Add support for 'outputs' MPD command --- mopidy/mpd/handler.py | 8 ++++++++ tests/mpd/handlertest.py | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mopidy/mpd/handler.py b/mopidy/mpd/handler.py index f3395fd8..ef7274f8 100644 --- a/mopidy/mpd/handler.py +++ b/mopidy/mpd/handler.py @@ -220,6 +220,14 @@ class MpdHandler(object): def _next(self): return self.backend.playback.next() + @register(r'^outputs$') + def _outputs(self): + return [ + ('outputid', 0), + ('outputname', self.backend.__class__.__name__), + ('outputenabled', 1), + ] + @register(r'^password "(?P[^"]+)"$') def _password(self, password): raise MpdNotImplemented # TODO diff --git a/tests/mpd/handlertest.py b/tests/mpd/handlertest.py index a6716bc2..a9a9d653 100644 --- a/tests/mpd/handlertest.py +++ b/tests/mpd/handlertest.py @@ -774,11 +774,17 @@ class ConnectionHandlerTest(unittest.TestCase): result = self.h.handle_request(u'ping') self.assert_(u'OK' in result) + class AudioOutputHandlerTest(unittest.TestCase): def setUp(self): self.h = handler.MpdHandler(backend=DummyBackend()) - pass # TODO + def test_outputs(self): + result = self.h.handle_request(u'outputs') + self.assert_(u'outputid: 0' in result) + self.assert_(u'outputname: DummyBackend' in result) + self.assert_(u'outputenabled: 1' in result) + self.assert_(u'OK' in result) class ReflectionHandlerTest(unittest.TestCase):