Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
6f595e9a
Commit
6f595e9a
authored
Oct 23, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/queue: add optional position parameter to "add"
Closes
https://github.com/MusicPlayerDaemon/MPD/issues/1285
parent
35c4c7e8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
7 deletions
+28
-7
NEWS
NEWS
+2
-0
protocol.rst
doc/protocol.rst
+4
-1
meson.build
meson.build
+1
-1
AllCommands.cxx
src/command/AllCommands.cxx
+1
-1
QueueCommands.cxx
src/command/QueueCommands.cxx
+20
-4
No files found.
NEWS
View file @
6f595e9a
ver 0.23.3 (not yet released)
* protocol
- add optional position parameter to "add"
* output
- alsa: add option "stop_dsd_silence" to work around DSD DAC noise
* macOS: fix libfmt related build failure
...
...
doc/protocol.rst
View file @
6f595e9a
...
...
@@ -689,11 +689,14 @@ Whenever possible, ids should be used.
.. _command_add:
:command:`add {URI}`
:command:`add {URI}
[POSITION]
`
Adds the file ``URI`` to the playlist
(directories add recursively). ``URI``
can also be a single file.
The position parameter is the same as in :ref:`addid
<command_addid>`.
Clients that are connected via local socket may add arbitrary
local files (URI is an absolute path). Example::
...
...
meson.build
View file @
6f595e9a
...
...
@@ -44,7 +44,7 @@ version_conf = configuration_data()
version_conf.set_quoted('PACKAGE', meson.project_name())
version_conf.set_quoted('PACKAGE_NAME', meson.project_name())
version_conf.set_quoted('VERSION', meson.project_version())
version_conf.set_quoted('PROTOCOL_VERSION', '0.23.
1
')
version_conf.set_quoted('PROTOCOL_VERSION', '0.23.
3
')
configure_file(output: 'Version.h', configuration: version_conf)
conf = configuration_data()
...
...
src/command/AllCommands.cxx
View file @
6f595e9a
...
...
@@ -85,7 +85,7 @@ handle_not_commands(Client &client, Request request, Response &response);
* This array must be sorted!
*/
static
constexpr
struct
command
commands
[]
=
{
{
"add"
,
PERMISSION_ADD
,
1
,
1
,
handle_add
},
{
"add"
,
PERMISSION_ADD
,
1
,
2
,
handle_add
},
{
"addid"
,
PERMISSION_ADD
,
1
,
2
,
handle_addid
},
{
"addtagid"
,
PERMISSION_ADD
,
3
,
3
,
handle_addtagid
},
{
"albumart"
,
PERMISSION_READ
,
2
,
2
,
handle_album_art
},
...
...
src/command/QueueCommands.cxx
View file @
6f595e9a
...
...
@@ -79,6 +79,11 @@ handle_add(Client &client, Request args, [[maybe_unused]] Response &r)
here */
uri
=
""
;
const
auto
old_size
=
partition
.
playlist
.
GetLength
();
const
unsigned
position
=
args
.
size
>
1
?
ParseInsertPosition
(
args
[
1
],
partition
.
playlist
)
:
old_size
;
const
auto
located_uri
=
LocateUri
(
UriPluginKind
::
INPUT
,
uri
,
&
client
#ifdef ENABLE_DATABASE
...
...
@@ -89,23 +94,34 @@ handle_add(Client &client, Request args, [[maybe_unused]] Response &r)
case
LocatedUri
:
:
Type
::
ABSOLUTE
:
AddUri
(
client
,
located_uri
);
client
.
GetInstance
().
LookupRemoteTag
(
located_uri
.
canonical_uri
);
return
CommandResult
::
OK
;
break
;
case
LocatedUri
:
:
Type
::
PATH
:
AddUri
(
client
,
located_uri
);
return
CommandResult
::
OK
;
break
;
case
LocatedUri
:
:
Type
::
RELATIVE
:
#ifdef ENABLE_DATABASE
AddDatabaseSelection
(
partition
,
located_uri
.
canonical_uri
);
return
CommandResult
::
OK
;
break
;
#else
r
.
Error
(
ACK_ERROR_NO_EXIST
,
"No database"
);
return
CommandResult
::
ERROR
;
#endif
}
gcc_unreachable
();
if
(
position
<
old_size
)
{
const
unsigned
new_size
=
partition
.
playlist
.
GetLength
();
const
RangeArg
move_range
{
old_size
,
new_size
};
try
{
partition
.
MoveRange
(
move_range
,
position
);
}
catch
(...)
{
/* ignore - shall we handle it? */
}
}
return
CommandResult
::
OK
;
}
CommandResult
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment