using System.Collections.Generic;
namespace LibMpc
{
public partial class Commands
{
///
/// https://www.musicpd.org/doc/protocol/output_commands.html
///
public class Output
{
///
/// Turns an output off.
///
public class DisableOutput : IMpcCommand
{
private readonly int _outputId;
public DisableOutput(int outputId)
{
_outputId = outputId;
}
public string Value => string.Join(" ", "disableoutput", _outputId);
public IReadOnlyDictionary> FormatResponse(IReadOnlyDictionary> response)
{
return response;
}
}
///
/// Turns an output on.
///
public class EnableOutput : IMpcCommand
{
private readonly int _outputId;
public EnableOutput(int outputId)
{
_outputId = outputId;
}
public string Value => string.Join(" ", "enableoutput", _outputId);
public IReadOnlyDictionary> FormatResponse(IReadOnlyDictionary> response)
{
return response;
}
}
// TODO: toggleoutput // Turns an output on or off, depending on the current state.
///
/// Shows information about all outputs.
///
public class Outputs : IMpcCommand>
{
public string Value => "outputs";
public IReadOnlyDictionary>> FormatResponse(IReadOnlyDictionary> response)
{
var result = new Dictionary>>
{
{"outputs", new List>()}
};
for (var i = 0; i < response["outputid"].Count; i++)
{
result["outputs"].Add(new Dictionary
{
{ "id", response["outputid"][i] },
{ "name", response["outputname"][i] },
{ "enabled", response["outputenabled"][i] }
});
}
return result;
}
}
}
}
}