diff options
author | Max Kellermann <max@duempel.org> | 2014-10-25 23:49:35 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-10-25 23:50:47 +0200 |
commit | 575fbad254a1ce67530bf2aedc9852c89c072c3f (patch) | |
tree | 612ed62b05b787ee737baaca7c87d99a3bbae7cc | |
parent | fa0aa91bf9e412e121d538632cbce3cce08ea0e0 (diff) | |
download | mpd-575fbad254a1ce67530bf2aedc9852c89c072c3f.tar.gz mpd-575fbad254a1ce67530bf2aedc9852c89c072c3f.tar.xz mpd-575fbad254a1ce67530bf2aedc9852c89c072c3f.zip |
AllCommands: "commands" returns playlist commands only if playlist_directory configured
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | src/command/AllCommands.cxx | 10 | ||||
-rw-r--r-- | src/command/PlaylistCommands.cxx | 8 | ||||
-rw-r--r-- | src/command/PlaylistCommands.hxx | 5 |
4 files changed, 25 insertions, 0 deletions
@@ -1,4 +1,6 @@ ver 0.20 (not yet released) +* protocol + - "commands" returns playlist commands only if playlist_directory configured * output - pulse: set channel map to WAVE-EX diff --git a/src/command/AllCommands.cxx b/src/command/AllCommands.cxx index 6a4b18198..be3a343a5 100644 --- a/src/command/AllCommands.cxx +++ b/src/command/AllCommands.cxx @@ -210,6 +210,16 @@ command_available(gcc_unused const Partition &partition, return neighbor_commands_available(partition.instance); #endif + if (strcmp(cmd->cmd, "save") == 0 || + strcmp(cmd->cmd, "rm") == 0 || + strcmp(cmd->cmd, "rename") == 0 || + strcmp(cmd->cmd, "playlistdelete") == 0 || + strcmp(cmd->cmd, "playlistmove") == 0 || + strcmp(cmd->cmd, "playlistclear") == 0 || + strcmp(cmd->cmd, "playlistadd") == 0 || + strcmp(cmd->cmd, "listplaylists") == 0) + return playlist_commands_available(); + return true; } diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx index c2b18064c..593eab865 100644 --- a/src/command/PlaylistCommands.cxx +++ b/src/command/PlaylistCommands.cxx @@ -35,9 +35,17 @@ #include "protocol/ArgParser.hxx" #include "protocol/Result.hxx" #include "ls.hxx" +#include "Mapper.hxx" +#include "fs/AllocatedPath.hxx" #include "util/UriUtil.hxx" #include "util/Error.hxx" +bool +playlist_commands_available() +{ + return !map_spl_path().IsNull(); +} + static void print_spl_list(Client &client, const PlaylistVector &list) { diff --git a/src/command/PlaylistCommands.hxx b/src/command/PlaylistCommands.hxx index fba4e1318..6dc589c8b 100644 --- a/src/command/PlaylistCommands.hxx +++ b/src/command/PlaylistCommands.hxx @@ -21,9 +21,14 @@ #define MPD_PLAYLIST_COMMANDS_HXX #include "CommandResult.hxx" +#include "Compiler.h" class Client; +gcc_const +bool +playlist_commands_available(); + CommandResult handle_save(Client &client, unsigned argc, char *argv[]); |