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
ade847bc
Commit
ade847bc
authored
Oct 25, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlaylistFile: fold spl_move_index() into handle_playlistmove()
parent
a6173e0e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
29 deletions
+11
-29
PlaylistFile.cxx
src/PlaylistFile.cxx
+0
-21
PlaylistFile.hxx
src/PlaylistFile.hxx
+0
-6
PlaylistCommands.cxx
src/command/PlaylistCommands.cxx
+11
-2
No files found.
src/PlaylistFile.cxx
View file @
ade847bc
...
...
@@ -322,19 +322,6 @@ PlaylistFileEditor::Save()
}
void
spl_move_index
(
const
char
*
utf8path
,
unsigned
src
,
unsigned
dest
)
{
if
(
src
==
dest
)
/* this doesn't check whether the playlist exists, but
what the hell.. */
return
;
PlaylistFileEditor
editor
(
utf8path
,
PlaylistFileEditor
::
LoadMode
::
YES
);
editor
.
MoveIndex
(
src
,
dest
);
editor
.
Save
();
}
void
spl_clear
(
const
char
*
utf8path
)
{
const
auto
path_fs
=
spl_map_to_fs
(
utf8path
);
...
...
@@ -373,14 +360,6 @@ spl_delete(const char *name_utf8)
}
void
spl_remove_index
(
const
char
*
utf8path
,
unsigned
pos
)
{
PlaylistFileEditor
editor
(
utf8path
,
PlaylistFileEditor
::
LoadMode
::
YES
);
editor
.
RemoveIndex
(
pos
);
editor
.
Save
();
}
void
spl_append_song
(
const
char
*
utf8path
,
const
DetachedSong
&
song
)
try
{
const
auto
path_fs
=
spl_map_to_fs
(
utf8path
);
...
...
src/PlaylistFile.hxx
View file @
ade847bc
...
...
@@ -90,18 +90,12 @@ PlaylistVector
ListPlaylistFiles
();
void
spl_move_index
(
const
char
*
utf8path
,
unsigned
src
,
unsigned
dest
);
void
spl_clear
(
const
char
*
utf8path
);
void
spl_delete
(
const
char
*
name_utf8
);
void
spl_remove_index
(
const
char
*
utf8path
,
unsigned
pos
);
void
spl_append_song
(
const
char
*
utf8path
,
const
DetachedSong
&
song
);
/**
...
...
src/command/PlaylistCommands.cxx
View file @
ade847bc
...
...
@@ -177,7 +177,9 @@ handle_playlistdelete([[maybe_unused]] Client &client,
const
char
*
const
name
=
args
[
0
];
unsigned
from
=
args
.
ParseUnsigned
(
1
);
spl_remove_index
(
name
,
from
);
PlaylistFileEditor
editor
(
name
,
PlaylistFileEditor
::
LoadMode
::
YES
);
editor
.
RemoveIndex
(
from
);
editor
.
Save
();
return
CommandResult
::
OK
;
}
...
...
@@ -189,7 +191,14 @@ handle_playlistmove([[maybe_unused]] Client &client,
unsigned
from
=
args
.
ParseUnsigned
(
1
);
unsigned
to
=
args
.
ParseUnsigned
(
2
);
spl_move_index
(
name
,
from
,
to
);
if
(
from
==
to
)
/* this doesn't check whether the playlist exists, but
what the hell.. */
return
CommandResult
::
OK
;
PlaylistFileEditor
editor
(
name
,
PlaylistFileEditor
::
LoadMode
::
YES
);
editor
.
MoveIndex
(
from
,
to
);
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