1
0
mirror of https://github.com/ZetaKebab/MpcNET.git synced 2025-07-01 00:37:37 +00:00
Files
MpcNET/src/MpcNET/Commands/Playlist/ListPlaylistCommand.cs
Kim Hugener-Ohlsen a2c012dd7e Various improvements
2018-01-05 10:18:57 +01:00

28 lines
808 B
C#

using System.Collections.Generic;
using System.Linq;
using MpcNET.Types;
namespace MpcNET.Commands.Playlist
{
/// <summary>
/// Lists the songs in the playlist.
/// </summary>
internal class ListPlaylistCommand : IMpcCommand<IEnumerable<IMpdFilePath>>
{
private readonly string _playlistName;
public ListPlaylistCommand(string playlistName)
{
_playlistName = playlistName;
}
public string Value => string.Join(" ", "listplaylist", $"\"{_playlistName}\"");
public IEnumerable<IMpdFilePath> FormatResponse(IList<KeyValuePair<string, string>> response)
{
var results = response.Where(line => line.Key.Equals("file")).Select(line => new MpdFile(line.Value));
return results;
}
}
}