command/playlist: "load" supports relative positions

This commit also increases the PROTOCOL_VERSION so clients can detect
the availability of the feature.
This commit is contained in:
Max Kellermann
2021-10-18 22:07:25 +02:00
parent 07e8c338df
commit 31151cec3c
4 changed files with 7 additions and 4 deletions

View File

@@ -19,6 +19,7 @@
#include "config.h"
#include "PlaylistCommands.hxx"
#include "PositionArg.hxx"
#include "Request.hxx"
#include "Instance.hxx"
#include "db/Selection.hxx"
@@ -86,7 +87,7 @@ handle_load(Client &client, Request args, [[maybe_unused]] Response &r)
const unsigned old_size = playlist.GetLength();
const unsigned position = args.size > 2
? args.ParseUnsigned(2, old_size)
? ParseInsertPosition(args[2], partition.playlist)
: old_size;
const SongLoader loader(client);