db/DatabasePlaylist: pass DatabaseSelection to search_add_to_playlist()
This commit is contained in:
parent
de4fd4c059
commit
c60d374fc8
@ -188,9 +188,10 @@ handle_searchaddpl(Client &client, Request args, Response &r)
|
|||||||
filter.Optimize();
|
filter.Optimize();
|
||||||
|
|
||||||
const Database &db = client.GetDatabaseOrThrow();
|
const Database &db = client.GetDatabaseOrThrow();
|
||||||
|
const DatabaseSelection selection("", true, &filter);
|
||||||
|
|
||||||
search_add_to_playlist(db, client.GetStorage(),
|
search_add_to_playlist(db, client.GetStorage(),
|
||||||
"", playlist, &filter);
|
playlist, selection);
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "PlaylistCommands.hxx"
|
#include "PlaylistCommands.hxx"
|
||||||
#include "Request.hxx"
|
#include "Request.hxx"
|
||||||
|
#include "db/Selection.hxx"
|
||||||
#include "db/DatabasePlaylist.hxx"
|
#include "db/DatabasePlaylist.hxx"
|
||||||
#include "CommandError.hxx"
|
#include "CommandError.hxx"
|
||||||
#include "PlaylistSave.hxx"
|
#include "PlaylistSave.hxx"
|
||||||
@ -180,9 +181,10 @@ handle_playlistadd(Client &client, Request args, gcc_unused Response &r)
|
|||||||
} else {
|
} else {
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
const Database &db = client.GetDatabaseOrThrow();
|
const Database &db = client.GetDatabaseOrThrow();
|
||||||
|
const DatabaseSelection selection(uri, true, nullptr);
|
||||||
|
|
||||||
search_add_to_playlist(db, client.GetStorage(),
|
search_add_to_playlist(db, client.GetStorage(),
|
||||||
uri, playlist, nullptr);
|
playlist, selection);
|
||||||
#else
|
#else
|
||||||
r.Error(ACK_ERROR_NO_EXIST, "directory or file not found");
|
r.Error(ACK_ERROR_NO_EXIST, "directory or file not found");
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
@ -36,11 +36,9 @@ AddSong(const Storage *storage, const char *playlist_path_utf8,
|
|||||||
|
|
||||||
void
|
void
|
||||||
search_add_to_playlist(const Database &db, const Storage *storage,
|
search_add_to_playlist(const Database &db, const Storage *storage,
|
||||||
const char *uri, const char *playlist_path_utf8,
|
const char *playlist_path_utf8,
|
||||||
const SongFilter *filter)
|
const DatabaseSelection &selection)
|
||||||
{
|
{
|
||||||
const DatabaseSelection selection(uri, true, filter);
|
|
||||||
|
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
const auto f = std::bind(AddSong, storage,
|
const auto f = std::bind(AddSong, storage,
|
||||||
playlist_path_utf8, _1);
|
playlist_path_utf8, _1);
|
||||||
|
@ -24,12 +24,12 @@
|
|||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class Storage;
|
class Storage;
|
||||||
class SongFilter;
|
struct DatabaseSelection;
|
||||||
|
|
||||||
gcc_nonnull(3,4)
|
gcc_nonnull(3)
|
||||||
void
|
void
|
||||||
search_add_to_playlist(const Database &db, const Storage *storage,
|
search_add_to_playlist(const Database &db, const Storage *storage,
|
||||||
const char *uri, const char *path_utf8,
|
const char *playlist_path_utf8,
|
||||||
const SongFilter *filter);
|
const DatabaseSelection &selection);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user