diff options
author | Stefano Miccoli <stefano.miccoli@polimi.it> | 2019-02-13 21:55:15 +0100 |
---|---|---|
committer | Stefano Miccoli <stefano.miccoli@polimi.it> | 2019-02-26 00:12:09 +0100 |
commit | b3a458338a7c8ff3c230ee33d85e973d3dbc056a (patch) | |
tree | 66415bf77d560fe191ae36b11f50fd33a8385715 /src/command/PlaylistCommands.cxx | |
parent | 281461f0f07b27253f39a96d1c576d5f410b5802 (diff) |
allow loading playlists specified as absolute filesystem paths
implement for the "load" command the same logic used for the "add"
command: local clients can load playlist specified as absolute paths.
For relative paths the old logic is preserved: first look for a stored
playlist, then look in the music directory.
Diffstat (limited to 'src/command/PlaylistCommands.cxx')
-rw-r--r-- | src/command/PlaylistCommands.cxx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx index 77131227d..858cd2029 100644 --- a/src/command/PlaylistCommands.cxx +++ b/src/command/PlaylistCommands.cxx @@ -38,6 +38,7 @@ #include "util/UriUtil.hxx" #include "util/ConstBuffer.hxx" #include "util/ChronoUtil.hxx" +#include "LocateUri.hxx" bool playlist_commands_available() noexcept @@ -66,12 +67,17 @@ handle_save(Client &client, Request args, gcc_unused Response &r) CommandResult handle_load(Client &client, Request args, gcc_unused Response &r) { + const auto uri = LocateUri(args.front(), &client +#ifdef ENABLE_DATABASE + , nullptr +#endif + ); RangeArg range = args.ParseOptional(1, RangeArg::All()); const ScopeBulkEdit bulk_edit(client.GetPartition()); const SongLoader loader(client); - playlist_open_into_queue(args.front(), + playlist_open_into_queue(uri, range.start, range.end, client.GetPlaylist(), client.GetPlayerControl(), loader); @@ -81,7 +87,11 @@ handle_load(Client &client, Request args, gcc_unused Response &r) CommandResult handle_listplaylist(Client &client, Request args, Response &r) { - const char *const name = args.front(); + const auto name = LocateUri(args.front(), &client +#ifdef ENABLE_DATABASE + , nullptr +#endif + ); if (playlist_file_print(r, client.GetPartition(), SongLoader(client), name, false)) @@ -93,7 +103,11 @@ handle_listplaylist(Client &client, Request args, Response &r) CommandResult handle_listplaylistinfo(Client &client, Request args, Response &r) { - const char *const name = args.front(); + const auto name = LocateUri(args.front(), &client +#ifdef ENABLE_DATABASE + , nullptr +#endif + ); if (playlist_file_print(r, client.GetPartition(), SongLoader(client), name, true)) |