mirror of
https://github.com/ZetaKebab/MpcNET.git
synced 2025-07-01 08:47:36 +00:00
listplaylists command created + test.
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
namespace LibMpc
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LibMpc.Types;
|
||||
|
||||
namespace LibMpc
|
||||
{
|
||||
public partial class Commands
|
||||
{
|
||||
@ -17,7 +21,32 @@
|
||||
/// </summary>
|
||||
public static class Stored
|
||||
{
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user