db: add compile-time option to disable database

This commit is contained in:
Max Kellermann
2014-01-30 20:29:48 +01:00
parent 34b309b99a
commit 4465e2c46b
25 changed files with 297 additions and 57 deletions

View File

@@ -110,6 +110,8 @@ playlist_print_changes_position(Client &client,
queue_print_changes_position(client, playlist.queue, version);
}
#ifdef ENABLE_DATABASE
static bool
PrintSongDetails(Client &client, const char *uri_utf8)
{
@@ -126,16 +128,24 @@ PrintSongDetails(Client &client, const char *uri_utf8)
return true;
}
#endif
bool
spl_print(Client &client, const char *name_utf8, bool detail,
Error &error)
{
#ifndef ENABLE_DATABASE
(void)detail;
#endif
PlaylistFileContents contents = LoadPlaylistFile(name_utf8, error);
if (contents.empty() && error.IsDefined())
return false;
for (const auto &uri_utf8 : contents) {
#ifdef ENABLE_DATABASE
if (!detail || !PrintSongDetails(client, uri_utf8.c_str()))
#endif
client_printf(client, SONG_FILE "%s\n",
uri_utf8.c_str());
}