Allow range in listplaylist and listplaylistinfo

This commit is contained in:
jcorporation
2024-02-08 21:26:28 +01:00
parent c71e586c53
commit a3794f8c3b
6 changed files with 37 additions and 13 deletions

View File

@@ -117,8 +117,8 @@ static constexpr struct command commands[] = {
{ "listneighbors", PERMISSION_READ, 0, 0, handle_listneighbors },
#endif
{ "listpartitions", PERMISSION_READ, 0, 0, handle_listpartitions },
{ "listplaylist", PERMISSION_READ, 1, 1, handle_listplaylist },
{ "listplaylistinfo", PERMISSION_READ, 1, 1, handle_listplaylistinfo },
{ "listplaylist", PERMISSION_READ, 1, 2, handle_listplaylist },
{ "listplaylistinfo", PERMISSION_READ, 1, 2, handle_listplaylistinfo },
{ "listplaylists", PERMISSION_READ, 0, 0, handle_listplaylists },
{ "load", PERMISSION_ADD, 1, 3, handle_load },
{ "lsinfo", PERMISSION_READ, 0, 1, handle_lsinfo },

View File

@@ -125,8 +125,10 @@ handle_listplaylist(Client &client, Request args, Response &r)
#endif
);
RangeArg range = args.ParseOptional(1, RangeArg::All());
if (playlist_file_print(r, client.GetPartition(), SongLoader(client),
name, false))
name, range.start, range.end, false))
return CommandResult::OK;
throw PlaylistError::NoSuchList();
@@ -142,8 +144,10 @@ handle_listplaylistinfo(Client &client, Request args, Response &r)
#endif
);
RangeArg range = args.ParseOptional(1, RangeArg::All());
if (playlist_file_print(r, client.GetPartition(), SongLoader(client),
name, true))
name, range.start, range.end, true))
return CommandResult::OK;
throw PlaylistError::NoSuchList();