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

1
NEWS
View File

@ -1,6 +1,7 @@
ver 0.23.1 (not yet released) ver 0.23.1 (not yet released)
* protocol * protocol
- use decimal notation instead of scientific notation - use decimal notation instead of scientific notation
- "load" supports relative positions
* output * output
- pipewire: attempt to change the graph sample rate - pipewire: attempt to change the graph sample rate
- snapcast: fix time stamp bug which caused "Failed to get chunk" - snapcast: fix time stamp bug which caused "Failed to get chunk"

View File

@ -923,8 +923,9 @@ remote playlists (absolute URI with a supported scheme).
only a part of the playlist. only a part of the playlist.
The ``POSITION`` parameter specifies where the songs will be The ``POSITION`` parameter specifies where the songs will be
inserted into the queue. (This requires specifying the range as inserted into the queue; it can be relative as described in
well; the special value `0:` can be used if the whole playlist :ref:`addid <command_addid>`. (This requires specifying the range
as well; the special value `0:` can be used if the whole playlist
shall be loaded at a certain queue position.) shall be loaded at a certain queue position.)
.. _command_playlistadd: .. _command_playlistadd:

View File

@ -44,7 +44,7 @@ version_conf = configuration_data()
version_conf.set_quoted('PACKAGE', meson.project_name()) version_conf.set_quoted('PACKAGE', meson.project_name())
version_conf.set_quoted('PACKAGE_NAME', meson.project_name()) version_conf.set_quoted('PACKAGE_NAME', meson.project_name())
version_conf.set_quoted('VERSION', meson.project_version()) version_conf.set_quoted('VERSION', meson.project_version())
version_conf.set_quoted('PROTOCOL_VERSION', '0.23.0') version_conf.set_quoted('PROTOCOL_VERSION', '0.23.1')
configure_file(output: 'Version.h', configuration: version_conf) configure_file(output: 'Version.h', configuration: version_conf)
conf = configuration_data() conf = configuration_data()

View File

@ -19,6 +19,7 @@
#include "config.h" #include "config.h"
#include "PlaylistCommands.hxx" #include "PlaylistCommands.hxx"
#include "PositionArg.hxx"
#include "Request.hxx" #include "Request.hxx"
#include "Instance.hxx" #include "Instance.hxx"
#include "db/Selection.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 old_size = playlist.GetLength();
const unsigned position = args.size > 2 const unsigned position = args.size > 2
? args.ParseUnsigned(2, old_size) ? ParseInsertPosition(args[2], partition.playlist)
: old_size; : old_size;
const SongLoader loader(client); const SongLoader loader(client);