#NEWLINE# @ protocol . commands . add ( 'toggleoutput' , outputid = protocol . UINT ) #NEWLINE# def toggleoutput( context , outputid ) : #NEWLINE# #INDENT# '\n    *musicpd.org, audio output section:*\n\n        ``toggleoutput {ID}``\n\n        Turns an output on or off, depending on the current state.\n    ' #NEWLINE# if ( outputid == 0 ) : #NEWLINE# #INDENT# mute_status = context . core . mixer . get_mute ( ) . get ( ) #NEWLINE# success = context . core . mixer . set_mute ( ( not mute_status ) ) #NEWLINE# if ( not outputid ) : #NEWLINE# #INDENT# raise exceptions . MpdSystemError ( 'problems toggling output' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise exceptions . MpdNoExistError ( 'No such audio output' )