diff options
author | Max Kellermann <max@musicpd.org> | 2018-11-12 13:19:10 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-11-12 13:19:10 +0100 |
commit | 89e7a5018d20dd73338bcc52c981ff76bcf4f191 (patch) | |
tree | 99646a597a0d23a406affbdffdc4a9b369d38ed9 | |
parent | 7235b46e5e232bef342fb5bcf803573fb02dc3ae (diff) |
doc/protocol.rst: explain song positions vs ids
-rw-r--r-- | doc/protocol.rst | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/protocol.rst b/doc/protocol.rst index 633a2f6a5..064ae149e 100644 --- a/doc/protocol.rst +++ b/doc/protocol.rst @@ -553,6 +553,22 @@ The Queue naming convention, but for the sake of compatibility, we cannot rename commands. +There are two ways to address songs within the queue: by their +position and by their id. + +The position is a 1-based index. It is unstable by design: if you +move, delete or insert songs, all following indices will change, and a +client can never be sure what song is behind a given index/position. + +Song ids on the other hand are stable: an id is assigned to a song +when it is added, and will stay the same, no matter how much it is +moved around. Adding the same song twice will assign different ids to +them, and a deleted-and-readded song will have a new id. This way, a +client can always be sure the correct song is being used. + +Many commands come in two flavors, one for each address type. +Whenever possible, ids should be used. + :command:`add {URI}` Adds the file ``URI`` to the playlist (directories add recursively). ``URI`` |