from __future__ import unicode_literals

from mopidy.frontends.mpd.protocol import handle_request


@handle_request(r'^disableoutput "(?P<outputid>\d+)"$')
def disableoutput(context, outputid):
    """
    *musicpd.org, audio output section:*

        ``disableoutput``

        Turns an output off.
    """
    if int(outputid) == 0:
        context.core.playback.set_mute(True)


@handle_request(r'^enableoutput "(?P<outputid>\d+)"$')
def enableoutput(context, outputid):
    """
    *musicpd.org, audio output section:*

        ``enableoutput``

        Turns an output on.
    """
    if int(outputid) == 0:
        context.core.playback.set_mute(False)


@handle_request(r'^outputs$')
def outputs(context):
    """
    *musicpd.org, audio output section:*

        ``outputs``

        Shows information about all outputs.
    """
    enabled = 0 if context.core.playback.get_mute().get() else 1
    return [
        ('outputid', 0),
        ('outputname', 'Default'),
        ('outputenabled', enabled),
    ]

@@ -373,16 +373,67 @@
 e(True)%0A
+    # TODO Return proper error on unknown outputid%0A
 %0A%0A@handl
@@ -703,16 +703,67 @@
 (False)%0A
+    # TODO Return proper error on unknown outputid%0A
 %0A%0A@handl

Add TODO for handling unknown outpitid