bpd: make noidle a no-op outside idle mode

The real MPD ignores `noidle` when the client is not idle. It doesn't
even send a successful response, just ignores the command. Although
I don't understand why a client would fail to keep track of its own
state, it seems that this is necessary to get ncmpcpp working.
This commit is contained in:
Carl Suster 2019-04-15 15:08:47 +10:00
parent e708d28f85
commit 27c462d287
2 changed files with 11 additions and 0 deletions

View file

@ -847,6 +847,9 @@ class MPDConnection(Connection):
yield self.send(err.response())
break
continue
if line == u'noidle':
# When not in idle, this command sends no response.
continue
if clist is not None:
# Command list already opened.

View file

@ -457,6 +457,14 @@ class BPDQueryTest(BPDTestHelper):
response = client.send_command('noidle')
self._assert_ok(response)
def test_cmd_noidle_when_not_idle(self):
with self.run_bpd() as client:
# Manually send a command without reading a response.
request = client.serialise_command('noidle')
client.sock.sendall(request)
response = client.send_command('notacommand')
self._assert_failed(response, bpd.ERROR_UNKNOWN)
class BPDPlaybackTest(BPDTestHelper):
test_implements_playback = implements({