'Connect to the MPD.'

def connect(self):

    host = mpd_config['host'].as_str()
    port = mpd_config['port'].get(int)
    if (host[0] in ['/', '~']):
        host = os.path.expanduser(host)
    self._log.info(u'connecting    to    {0}:{1}', host, port)
    try:
        self.client.connect(host, port)
    except socket.error as e:
        raise ui.UserError(u'could    not    connect    to    MPD:    {0}'.format(e))
    password = mpd_config['password'].as_str()
    if password:
        try:
            self.client.password(password)
        except mpd.CommandError as e:
            raise ui.UserError(u'could    not    authenticate    to    MPD:    {0}'.format(e))
