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
34644978
Commit
34644978
authored
Nov 09, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/database: add optional position parameter to "searchaddpl"
Closes
https://github.com/MusicPlayerDaemon/MPD/issues/1328
parent
651f57bc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
4 deletions
+43
-4
NEWS
NEWS
+2
-0
protocol.rst
doc/protocol.rst
+5
-1
meson.build
meson.build
+1
-1
DatabaseCommands.cxx
src/command/DatabaseCommands.cxx
+9
-2
DatabasePlaylist.cxx
src/db/DatabasePlaylist.cxx
+20
-0
DatabasePlaylist.hxx
src/db/DatabasePlaylist.hxx
+6
-0
No files found.
NEWS
View file @
34644978
ver 0.23.4 (not yet released)
* protocol
- add optional position parameter to "searchaddpl"
* decoder
- ffmpeg: support libavcodec 59
* output
...
...
doc/protocol.rst
View file @
34644978
...
...
@@ -1225,7 +1225,7 @@ The music database
.. _command_searchaddpl:
:command:`searchaddpl {NAME} {FILTER} [sort {TYPE}] [window {START:END}]`
:command:`searchaddpl {NAME} {FILTER} [sort {TYPE}] [window {START:END}]
[position POS]
`
Search the database for songs matching
``FILTER`` (see :ref:`Filters <filter_syntax>`) and add them to
the playlist named ``NAME``.
...
...
@@ -1234,6 +1234,9 @@ The music database
Parameters have the same meaning as for :ref:`search <command_search>`.
The ``position`` parameter specifies where the songs will be
inserted. [#since_0_23_4]_
.. _command_update:
:command:`update [URI]`
...
...
@@ -1655,3 +1658,4 @@ client-to-client messages are local to the current partition.
.. [#since_0_23] Since :program:`MPD` 0.23
.. [#since_0_23_1] Since :program:`MPD` 0.23.1
.. [#since_0_23_3] Since :program:`MPD` 0.23.3
.. [#since_0_23_4] Since :program:`MPD` 0.23.4
meson.build
View file @
34644978
...
...
@@ -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.
3
')
version_conf.set_quoted('PROTOCOL_VERSION', '0.23.
4
')
configure_file(output: 'Version.h', configuration: version_conf)
conf = configuration_data()
...
...
src/command/DatabaseCommands.cxx
View file @
34644978
...
...
@@ -199,13 +199,20 @@ handle_searchaddpl(Client &client, Request args, Response &)
{
const
char
*
playlist
=
args
.
shift
();
const
unsigned
position
=
ParseQueuePosition
(
args
,
UINT_MAX
);
SongFilter
filter
;
const
auto
selection
=
ParseDatabaseSelection
(
args
,
true
,
filter
);
const
Database
&
db
=
client
.
GetDatabaseOrThrow
();
search_add_to_playlist
(
db
,
client
.
GetStorage
(),
playlist
,
selection
);
if
(
position
==
UINT_MAX
)
search_add_to_playlist
(
db
,
client
.
GetStorage
(),
playlist
,
selection
);
else
SearchInsertIntoPlaylist
(
db
,
client
.
GetStorage
(),
selection
,
playlist
,
position
);
return
CommandResult
::
OK
;
}
...
...
src/db/DatabasePlaylist.cxx
View file @
34644978
...
...
@@ -22,6 +22,7 @@
#include "PlaylistFile.hxx"
#include "Interface.hxx"
#include "song/DetachedSong.hxx"
#include "protocol/Ack.hxx"
#include <functional>
...
...
@@ -61,3 +62,22 @@ SearchInsertIntoPlaylist(const Database &db, const Storage *storage,
return
n
;
}
void
SearchInsertIntoPlaylist
(
const
Database
&
db
,
const
Storage
*
storage
,
const
DatabaseSelection
&
selection
,
const
char
*
playlist_name
,
unsigned
position
)
{
PlaylistFileEditor
editor
{
playlist_name
,
PlaylistFileEditor
::
LoadMode
::
TRY
,
};
if
(
position
>
editor
.
size
())
throw
ProtocolError
{
ACK_ERROR_ARG
,
"Bad position"
};
if
(
SearchInsertIntoPlaylist
(
db
,
storage
,
selection
,
editor
,
position
)
>
0
)
editor
.
Save
();
}
src/db/DatabasePlaylist.hxx
View file @
34644978
...
...
@@ -42,4 +42,10 @@ SearchInsertIntoPlaylist(const Database &db, const Storage *storage,
PlaylistFileEditor
&
playlist
,
unsigned
position
);
void
SearchInsertIntoPlaylist
(
const
Database
&
db
,
const
Storage
*
storage
,
const
DatabaseSelection
&
selection
,
const
char
*
playlist_name
,
unsigned
position
);
#endif
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