From c60d374fc85364458f9fce242370abcd7fc8f40c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 25 Mar 2019 18:48:31 +0100 Subject: [PATCH] db/DatabasePlaylist: pass DatabaseSelection to search_add_to_playlist() --- src/command/DatabaseCommands.cxx | 3 ++- src/command/PlaylistCommands.cxx | 4 +++- src/db/DatabasePlaylist.cxx | 6 ++---- src/db/DatabasePlaylist.hxx | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx index 3f0bc4f51..262254b55 100644 --- a/src/command/DatabaseCommands.cxx +++ b/src/command/DatabaseCommands.cxx @@ -188,9 +188,10 @@ handle_searchaddpl(Client &client, Request args, Response &r) filter.Optimize(); const Database &db = client.GetDatabaseOrThrow(); + const DatabaseSelection selection("", true, &filter); search_add_to_playlist(db, client.GetStorage(), - "", playlist, &filter); + playlist, selection); return CommandResult::OK; } diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx index 858cd2029..9c0ae779d 100644 --- a/src/command/PlaylistCommands.cxx +++ b/src/command/PlaylistCommands.cxx @@ -20,6 +20,7 @@ #include "config.h" #include "PlaylistCommands.hxx" #include "Request.hxx" +#include "db/Selection.hxx" #include "db/DatabasePlaylist.hxx" #include "CommandError.hxx" #include "PlaylistSave.hxx" @@ -180,9 +181,10 @@ handle_playlistadd(Client &client, Request args, gcc_unused Response &r) } else { #ifdef ENABLE_DATABASE const Database &db = client.GetDatabaseOrThrow(); + const DatabaseSelection selection(uri, true, nullptr); search_add_to_playlist(db, client.GetStorage(), - uri, playlist, nullptr); + playlist, selection); #else r.Error(ACK_ERROR_NO_EXIST, "directory or file not found"); return CommandResult::ERROR; diff --git a/src/db/DatabasePlaylist.cxx b/src/db/DatabasePlaylist.cxx index 8e8cb97b0..8a0d1ff78 100644 --- a/src/db/DatabasePlaylist.cxx +++ b/src/db/DatabasePlaylist.cxx @@ -36,11 +36,9 @@ AddSong(const Storage *storage, const char *playlist_path_utf8, void search_add_to_playlist(const Database &db, const Storage *storage, - const char *uri, const char *playlist_path_utf8, - const SongFilter *filter) + const char *playlist_path_utf8, + const DatabaseSelection &selection) { - const DatabaseSelection selection(uri, true, filter); - using namespace std::placeholders; const auto f = std::bind(AddSong, storage, playlist_path_utf8, _1); diff --git a/src/db/DatabasePlaylist.hxx b/src/db/DatabasePlaylist.hxx index 9a83c30fa..18e536811 100644 --- a/src/db/DatabasePlaylist.hxx +++ b/src/db/DatabasePlaylist.hxx @@ -24,12 +24,12 @@ class Database; class Storage; -class SongFilter; +struct DatabaseSelection; -gcc_nonnull(3,4) +gcc_nonnull(3) void search_add_to_playlist(const Database &db, const Storage *storage, - const char *uri, const char *path_utf8, - const SongFilter *filter); + const char *playlist_path_utf8, + const DatabaseSelection &selection); #endif