This commit is contained in:
Max Kellermann
2024-02-15 11:28:11 +01:00
8 changed files with 130 additions and 1 deletions

View File

@@ -148,6 +148,7 @@ static constexpr struct command commands[] = {
{ "playlistfind", PERMISSION_READ, 1, -1, handle_playlistfind },
{ "playlistid", PERMISSION_READ, 0, 1, handle_playlistid },
{ "playlistinfo", PERMISSION_READ, 0, 1, handle_playlistinfo },
{ "playlistlength", PERMISSION_READ, 1, 1, handle_playlistlength },
{ "playlistmove", PERMISSION_CONTROL, 3, 3, handle_playlistmove },
{ "playlistsearch", PERMISSION_READ, 1, -1, handle_playlistsearch },
{ "plchanges", PERMISSION_READ, 1, 2, handle_plchanges },

View File

@@ -17,6 +17,7 @@
#include "SongLoader.hxx"
#include "song/DetachedSong.hxx"
#include "BulkEdit.hxx"
#include "playlist/Length.hxx"
#include "playlist/PlaylistQueue.hxx"
#include "playlist/Print.hxx"
#include "TimePrint.hxx"
@@ -153,6 +154,23 @@ handle_listplaylistinfo(Client &client, Request args, Response &r)
throw PlaylistError::NoSuchList();
}
CommandResult
handle_playlistlength(Client &client, Request args, Response &r)
{
const auto name = LocateUri(UriPluginKind::PLAYLIST, args.front(),
&client
#ifdef ENABLE_DATABASE
, nullptr
#endif
);
if (playlist_file_length(r, client.GetPartition(), SongLoader(client),
name))
return CommandResult::OK;
throw PlaylistError::NoSuchList();
}
CommandResult
handle_rm([[maybe_unused]] Client &client, Request args, [[maybe_unused]] Response &r)
{

View File

@@ -26,6 +26,9 @@ handle_listplaylist(Client &client, Request request, Response &response);
CommandResult
handle_listplaylistinfo(Client &client, Request request, Response &response);
CommandResult
handle_playlistlength(Client &client, Request request, Response &response);
CommandResult
handle_rm(Client &client, Request request, Response &response);