Source code for mopidy.mpd.protocol.connection

from __future__ import absolute_import, unicode_literals

from mopidy.mpd import exceptions, protocol

@protocol.commands.add('close', auth_required=False)
[docs]def close(context): """ *, connection section:* ``close`` Closes the connection to MPD. """ context.session.close()
@protocol.commands.add('kill', list_command=False)
[docs]def kill(context): """ *, connection section:* ``kill`` Kills MPD. """ raise exceptions.MpdPermissionError(command='kill')
@protocol.commands.add('password', auth_required=False)
[docs]def password(context, password): """ *, connection section:* ``password {PASSWORD}`` This is used for authentication with the server. ``PASSWORD`` is simply the plaintext password. """ if password == context.password: context.dispatcher.authenticated = True else: raise exceptions.MpdPasswordError('incorrect password')
@protocol.commands.add('ping', auth_required=False)
[docs]def ping(context): """ *, connection section:* ``ping`` Does nothing but return ``OK``. """ pass