1
0
mirror of https://github.com/ZetaKebab/MpcNET.git synced 2024-09-16 05:30:09 +00:00
MpcNET/LibMpc/Commands/Commands.Reflection.cs

60 lines
1.9 KiB
C#

using System.Collections.Generic;
using System.Linq;
namespace LibMpc
{
public partial class Commands
{
/// <summary>
/// https://www.musicpd.org/doc/protocol/reflection_commands.html
/// </summary>
public static class Reflection
{
// TODO: config
/// <summary>
/// Shows which commands the current user has access to.
/// </summary>
public class Commands : IMpcCommand<IEnumerable<string>>
{
public string Value => "commands";
public IEnumerable<string> FormatResponse(IList<KeyValuePair<string, string>> response)
{
var result = response.Where(item => item.Key.Equals("command")).Select(item => item.Value);
return result;
}
}
// TODO: notcommands
public class TagTypes : IMpcCommand<IEnumerable<string>>
{
public string Value => "tagtypes";
public IEnumerable<string> FormatResponse(IList<KeyValuePair<string, string>> response)
{
var result = response.Where(item => item.Key.Equals("tagtype")).Select(item => item.Value);
return result;
}
}
public class UrlHandlers : IMpcCommand<IEnumerable<string>>
{
public string Value => "urlhandlers";
public IEnumerable<string> FormatResponse(IList<KeyValuePair<string, string>> response)
{
var result = response.Where(item => item.Key.Equals("handler")).Select(item => item.Value);
return result;
}
}
// TODO: decoders
}
}
}