From 3af3eb5127d5e15c4b04d96c34e4e55c743de784 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Wed, 21 Nov 2012 01:29:14 +0100 Subject: [PATCH] mpd: Make 'decoders' return an empty response to please ncmpcpp --- docs/changes.rst | 4 ++++ mopidy/frontends/mpd/protocol/reflection.py | 10 ++++++++-- tests/frontends/mpd/protocol/reflection_test.py | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/changes.rst b/docs/changes.rst index 583e5c46..d62faf8e 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -88,6 +88,10 @@ long time been our most requested feature. Finally, it's here! - The MPD command ``list`` will no longer return artist names, album names, or dates that are blank. +- The MPD command ``decoders`` will now return an empty response instead of a + "not implemented" error to make the ncmpcpp browse view work the first time + it is opened. + **MPRIS frontend** - The MPRIS playlists interface is now supported by our MPRIS frontend. This diff --git a/mopidy/frontends/mpd/protocol/reflection.py b/mopidy/frontends/mpd/protocol/reflection.py index 5af86a1a..d9c35743 100644 --- a/mopidy/frontends/mpd/protocol/reflection.py +++ b/mopidy/frontends/mpd/protocol/reflection.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from mopidy.frontends.mpd.protocol import handle_request, mpd_commands -from mopidy.frontends.mpd.exceptions import MpdNotImplemented @handle_request(r'^commands$', auth_required=False) @@ -47,8 +46,15 @@ def decoders(context): mime_type: audio/mpeg plugin: mpcdec suffix: mpc + + *Clarifications:* + + - ncmpcpp asks for decoders the first time you open the browse view. By + returning nothing and OK instead of an not implemented error, we avoid + "Not implemented" showing up in the ncmpcpp interface, and we get the + list of playlists without having to enter the browse interface twice. """ - raise MpdNotImplemented # TODO + return # TODO @handle_request(r'^notcommands$', auth_required=False) diff --git a/tests/frontends/mpd/protocol/reflection_test.py b/tests/frontends/mpd/protocol/reflection_test.py index 33032d73..9c07f104 100644 --- a/tests/frontends/mpd/protocol/reflection_test.py +++ b/tests/frontends/mpd/protocol/reflection_test.py @@ -38,7 +38,7 @@ class ReflectionHandlerTest(protocol.BaseTestCase): def test_decoders(self): self.sendRequest('decoders') - self.assertInResponse('ACK [0@0] {} Not implemented') + self.assertInResponse('OK') def test_notcommands_returns_only_kill_and_ok(self): response = self.sendRequest('notcommands')