Commit ade847bc authored by Max Kellermann's avatar Max Kellermann

PlaylistFile: fold spl_move_index() into handle_playlistmove()

parent a6173e0e
...@@ -322,19 +322,6 @@ PlaylistFileEditor::Save() ...@@ -322,19 +322,6 @@ PlaylistFileEditor::Save()
} }
void 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) spl_clear(const char *utf8path)
{ {
const auto path_fs = spl_map_to_fs(utf8path); const auto path_fs = spl_map_to_fs(utf8path);
...@@ -373,14 +360,6 @@ spl_delete(const char *name_utf8) ...@@ -373,14 +360,6 @@ spl_delete(const char *name_utf8)
} }
void 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) spl_append_song(const char *utf8path, const DetachedSong &song)
try { try {
const auto path_fs = spl_map_to_fs(utf8path); const auto path_fs = spl_map_to_fs(utf8path);
......
...@@ -90,18 +90,12 @@ PlaylistVector ...@@ -90,18 +90,12 @@ PlaylistVector
ListPlaylistFiles(); ListPlaylistFiles();
void void
spl_move_index(const char *utf8path, unsigned src, unsigned dest);
void
spl_clear(const char *utf8path); spl_clear(const char *utf8path);
void void
spl_delete(const char *name_utf8); spl_delete(const char *name_utf8);
void void
spl_remove_index(const char *utf8path, unsigned pos);
void
spl_append_song(const char *utf8path, const DetachedSong &song); spl_append_song(const char *utf8path, const DetachedSong &song);
/** /**
......
...@@ -177,7 +177,9 @@ handle_playlistdelete([[maybe_unused]] Client &client, ...@@ -177,7 +177,9 @@ handle_playlistdelete([[maybe_unused]] Client &client,
const char *const name = args[0]; const char *const name = args[0];
unsigned from = args.ParseUnsigned(1); unsigned from = args.ParseUnsigned(1);
spl_remove_index(name, from); PlaylistFileEditor editor(name, PlaylistFileEditor::LoadMode::YES);
editor.RemoveIndex(from);
editor.Save();
return CommandResult::OK; return CommandResult::OK;
} }
...@@ -189,7 +191,14 @@ handle_playlistmove([[maybe_unused]] Client &client, ...@@ -189,7 +191,14 @@ handle_playlistmove([[maybe_unused]] Client &client,
unsigned from = args.ParseUnsigned(1); unsigned from = args.ParseUnsigned(1);
unsigned to = args.ParseUnsigned(2); 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; return CommandResult::OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment