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
48e8a268
Commit
48e8a268
authored
Oct 25, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/playlist: allow range in playlistdelete
parent
ade847bc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
3 deletions
+19
-3
NEWS
NEWS
+1
-0
protocol.rst
doc/protocol.rst
+3
-1
PlaylistFile.cxx
src/PlaylistFile.cxx
+11
-0
PlaylistFile.hxx
src/PlaylistFile.hxx
+2
-0
PlaylistCommands.cxx
src/command/PlaylistCommands.cxx
+2
-2
No files found.
NEWS
View file @
48e8a268
ver 0.23.3 (not yet released)
* protocol
- add optional position parameter to "add" and "playlistadd"
- allow range in "playlistdelete"
* output
- alsa: add option "stop_dsd_silence" to work around DSD DAC noise
* macOS: fix libfmt related build failure
...
...
doc/protocol.rst
View file @
48e8a268
...
...
@@ -929,7 +929,7 @@ remote playlists (absolute URI with a supported scheme).
inserted into the queue; it can be relative as described in
: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.) [#since_0_23_1]
shall be loaded at a certain queue position.) [#since_0_23_1]
_
.. _command_playlistadd:
...
...
@@ -953,6 +953,8 @@ remote playlists (absolute URI with a supported scheme).
Deletes ``SONGPOS`` from the
playlist `NAME.m3u`.
The second parameter can be a range. [#since_0_23_3]_
.. _command_playlistmove:
:command:`playlistmove {NAME} {FROM} {TO}`
...
...
src/PlaylistFile.cxx
View file @
48e8a268
...
...
@@ -26,6 +26,7 @@
#include "song/DetachedSong.hxx"
#include "SongLoader.hxx"
#include "Mapper.hxx"
#include "protocol/RangeArg.hxx"
#include "fs/io/TextFile.hxx"
#include "fs/io/FileOutputStream.hxx"
#include "fs/io/BufferedOutputStream.hxx"
...
...
@@ -315,6 +316,16 @@ PlaylistFileEditor::RemoveIndex(unsigned i)
}
void
PlaylistFileEditor
::
RemoveRange
(
RangeArg
range
)
{
if
(
!
range
.
CheckClip
(
size
()))
throw
PlaylistError
::
BadRange
();
contents
.
erase
(
std
::
next
(
contents
.
begin
(),
range
.
start
),
std
::
next
(
contents
.
begin
(),
range
.
end
));
}
void
PlaylistFileEditor
::
Save
()
{
SavePlaylistFile
(
path
,
contents
);
...
...
src/PlaylistFile.hxx
View file @
48e8a268
...
...
@@ -26,6 +26,7 @@
#include <string>
struct
ConfigData
;
struct
RangeArg
;
class
DetachedSong
;
class
SongLoader
;
class
PlaylistVector
;
...
...
@@ -60,6 +61,7 @@ public:
void
MoveIndex
(
unsigned
src
,
unsigned
dest
);
void
RemoveIndex
(
unsigned
i
);
void
RemoveRange
(
RangeArg
range
);
void
Save
();
...
...
src/command/PlaylistCommands.cxx
View file @
48e8a268
...
...
@@ -175,10 +175,10 @@ handle_playlistdelete([[maybe_unused]] Client &client,
Request
args
,
[[
maybe_unused
]]
Response
&
r
)
{
const
char
*
const
name
=
args
[
0
];
unsigned
from
=
args
.
ParseUnsigned
(
1
);
const
auto
range
=
args
.
ParseRange
(
1
);
PlaylistFileEditor
editor
(
name
,
PlaylistFileEditor
::
LoadMode
::
YES
);
editor
.
Remove
Index
(
from
);
editor
.
Remove
Range
(
range
);
editor
.
Save
();
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