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

91 lines
2.7 KiB
C#
Raw Normal View History

using System.Collections.Generic;
2016-12-02 12:24:03 +00:00
namespace LibMpc
{
public partial class Commands
{
/// <summary>
/// https://www.musicpd.org/doc/protocol/database.html
/// </summary>
public class Database
{
// TODO: count
public class Find : IMpcCommand<string>
2016-12-02 12:24:03 +00:00
{
2016-12-02 12:41:53 +00:00
private readonly ITag _tag;
2016-12-02 12:24:03 +00:00
private readonly string _searchText;
2016-12-02 12:41:53 +00:00
public Find(ITag tag, string searchText)
2016-12-02 12:24:03 +00:00
{
2016-12-02 12:41:53 +00:00
_tag = tag;
2016-12-02 12:24:03 +00:00
_searchText = searchText;
}
2016-12-02 12:41:53 +00:00
public string Value => string.Join(" ", "find", _tag.Value, _searchText);
2016-12-02 12:24:03 +00:00
public IDictionary<string, string> FormatResponse(IList<KeyValuePair<string, string>> response)
2016-12-02 12:24:03 +00:00
{
return response.ToDefaultDictionary();
2016-12-02 12:24:03 +00:00
}
}
public class List : IMpcCommand<string>
2016-12-02 12:24:03 +00:00
{
2016-12-02 12:41:53 +00:00
private readonly ITag _tag;
2016-12-02 12:24:03 +00:00
2016-12-02 12:41:53 +00:00
public List(ITag tag)
2016-12-02 12:24:03 +00:00
{
2016-12-02 12:41:53 +00:00
_tag = tag;
2016-12-02 12:24:03 +00:00
}
2016-12-02 12:41:53 +00:00
public string Value => string.Join(" ", "list", _tag);
2016-12-02 12:24:03 +00:00
public IDictionary<string, string> FormatResponse(IList<KeyValuePair<string, string>> response)
2016-12-02 12:24:03 +00:00
{
return response.ToDefaultDictionary();
2016-12-02 12:24:03 +00:00
}
}
// TODO: findadd
public class ListAll : IMpcCommand<string>
2016-12-02 12:24:03 +00:00
{
private readonly string _path;
public ListAll(string path)
{
_path = path;
}
public string Value => string.Join(" ", "listall", _path);
public IDictionary<string, string> FormatResponse(IList<KeyValuePair<string, string>> response)
2016-12-02 12:24:03 +00:00
{
return response.ToDefaultDictionary();
2016-12-02 12:24:03 +00:00
}
}
// TODO: listallinfo
// TODO: listfiles
// TODO: lsinfo
// TODO: readcomments
// TODO: search
// TODO: searchadd
// TODO: searchaddpl
public class Update : IMpcCommand<string>
2016-12-02 12:24:03 +00:00
{
// TODO: Extend command: < update [URI] >
2016-12-02 12:24:03 +00:00
public string Value => "update";
public IDictionary<string, string> FormatResponse(IList<KeyValuePair<string, string>> response)
2016-12-02 12:24:03 +00:00
{
return response.ToDefaultDictionary();
2016-12-02 12:24:03 +00:00
}
}
2016-12-02 12:24:03 +00:00
// TODO: rescan
}
}
}