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

53 lines
1.7 KiB
C#
Raw Normal View History

2016-12-20 14:26:09 +00:00
using System.Collections.Generic;
using System.Linq;
using LibMpc.Types;
namespace LibMpc
{
public partial class Commands
{
public static class Playlists
{
/// <summary>
/// https://www.musicpd.org/doc/protocol/queue.html
/// </summary>
public static class Current
{
}
/// <summary>
/// https://www.musicpd.org/doc/protocol/playlist_files.html
/// </summary>
public static class Stored
{
2016-12-20 14:26:09 +00:00
/// <summary>
/// Prints a list of the playlist directory.
/// </summary>
public class ListPlaylists : IMpcCommand<IEnumerable<MpdPlaylist>>
{
public string Value => "listplaylists";
public IEnumerable<MpdPlaylist> FormatResponse(IList<KeyValuePair<string, string>> response)
{
var result = new List<MpdPlaylist>();
foreach (var line in response)
{
if (line.Key.Equals("playlist"))
{
result.Add(new MpdPlaylist(line.Value));
}
else if (line.Key.Equals("Last-Modified"))
{
result.Last().AddLastModified(line.Value);
}
}
return result;
}
}
}
}
}
}