#NEWLINE# def connect( self , quiet = False ) : #NEWLINE# #INDENT# if self . connected : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# self . client . connect ( host = quiet . host , port = self . port ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# if ( not quiet ) : #NEWLINE# #INDENT# logger . exception ( 'Failed to connect to mpd' ) #NEWLINE# #UNINDENT# return False #NEWLINE# #UNINDENT# if self . password : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . client . password ( self . password ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# logger . warning ( 'Authentication failed.  Disconnecting' ) #NEWLINE# try : #NEWLINE# #INDENT# self . client . disconnect ( ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . connected = True #NEWLINE# return True