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
60889657
Commit
60889657
authored
Oct 14, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/queue: add position parameter to "load"
Another one from
https://github.com/MusicPlayerDaemon/MPD/issues/888
parent
2e5ca1cb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
3 deletions
+24
-3
NEWS
NEWS
+1
-0
protocol.rst
doc/protocol.rst
+6
-1
AllCommands.cxx
src/command/AllCommands.cxx
+1
-1
PlaylistCommands.cxx
src/command/PlaylistCommands.cxx
+16
-1
No files found.
NEWS
View file @
60889657
...
...
@@ -6,6 +6,7 @@ ver 0.23 (not yet released)
- support relative positions in "addid"
- fix relative positions in "move" and "moveid"
- add "position" parameter to "findadd" and "searchadd"
- add position parameter to "load"
* database
- proxy: require MPD 0.20 or later
- proxy: require libmpdclient 2.11 or later
...
...
doc/protocol.rst
View file @
60889657
...
...
@@ -917,11 +917,16 @@ remote playlists (absolute URI with a supported scheme).
.. _command_load:
:command:`load {NAME} [START:END]`
:command:`load {NAME} [START:END]
[POSITION]
`
Loads the playlist into the current queue. Playlist
plugins are supported. A range may be specified to load
only a part of the playlist.
The ``POSITION`` parameter specifies where the songs will be
inserted into the queue. (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.)
.. _command_playlistadd:
:command:`playlistadd {NAME} {URI}`
...
...
src/command/AllCommands.cxx
View file @
60889657
...
...
@@ -135,7 +135,7 @@ static constexpr struct command commands[] = {
{
"listplaylist"
,
PERMISSION_READ
,
1
,
1
,
handle_listplaylist
},
{
"listplaylistinfo"
,
PERMISSION_READ
,
1
,
1
,
handle_listplaylistinfo
},
{
"listplaylists"
,
PERMISSION_READ
,
0
,
0
,
handle_listplaylists
},
{
"load"
,
PERMISSION_ADD
,
1
,
2
,
handle_load
},
{
"load"
,
PERMISSION_ADD
,
1
,
3
,
handle_load
},
{
"lsinfo"
,
PERMISSION_READ
,
0
,
1
,
handle_lsinfo
},
{
"mixrampdb"
,
PERMISSION_PLAYER
,
1
,
1
,
handle_mixrampdb
},
{
"mixrampdelay"
,
PERMISSION_PLAYER
,
1
,
1
,
handle_mixrampdelay
},
...
...
src/command/PlaylistCommands.cxx
View file @
60889657
...
...
@@ -79,11 +79,16 @@ handle_load(Client &client, Request args, [[maybe_unused]] Response &r)
);
RangeArg
range
=
args
.
ParseOptional
(
1
,
RangeArg
::
All
());
const
ScopeBulkEdit
bulk_edit
(
client
.
GetPartition
());
auto
&
partition
=
client
.
GetPartition
();
const
ScopeBulkEdit
bulk_edit
(
partition
);
auto
&
playlist
=
client
.
GetPlaylist
();
const
unsigned
old_size
=
playlist
.
GetLength
();
const
unsigned
position
=
args
.
size
>
2
?
args
.
ParseUnsigned
(
2
,
old_size
)
:
old_size
;
const
SongLoader
loader
(
client
);
playlist_open_into_queue
(
uri
,
range
.
start
,
range
.
end
,
...
...
@@ -96,6 +101,16 @@ handle_load(Client &client, Request args, [[maybe_unused]] Response &r)
for
(
unsigned
i
=
old_size
;
i
<
new_size
;
++
i
)
instance
.
LookupRemoteTag
(
playlist
.
queue
.
Get
(
i
).
GetRealURI
());
if
(
position
<
old_size
)
{
const
RangeArg
move_range
{
old_size
,
new_size
};
try
{
partition
.
MoveRange
(
move_range
,
position
);
}
catch
(...)
{
/* ignore - shall we handle it? */
}
}
return
CommandResult
::
OK
;
}
...
...
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