db/DatabasePlaylist: pass DatabaseSelection to search_add_to_playlist()

This commit is contained in:
Max Kellermann 2019-03-25 18:48:31 +01:00
parent de4fd4c059
commit c60d374fc8
4 changed files with 11 additions and 10 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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