aboutsummaryrefslogtreecommitdiffstats
path: root/src/db_print.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-13 21:24:22 +0200
committerMax Kellermann <max@duempel.org>2011-09-13 22:09:37 +0200
commita236a439cc84035a70c3f43fd926d39b9d8caaf7 (patch)
tree846667477e41ad2b53897b90c61c1f9d3363b428 /src/db_print.c
parentc779e2674abbc3eed08e49296c188a9f9ed5270e (diff)
downloadmpd-a236a439cc84035a70c3f43fd926d39b9d8caaf7.tar.gz
mpd-a236a439cc84035a70c3f43fd926d39b9d8caaf7.tar.xz
mpd-a236a439cc84035a70c3f43fd926d39b9d8caaf7.zip
db_print: move code to function db_selection_print()
Use it in handle_lsinfo(), and eliminate some duplicate code.
Diffstat (limited to 'src/db_print.c')
-rw-r--r--src/db_print.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/db_print.c b/src/db_print.c
index 8f9bd5b97..f341ca4e8 100644
--- a/src/db_print.c
+++ b/src/db_print.c
@@ -19,6 +19,7 @@
#include "config.h"
#include "db_print.h"
+#include "db_selection.h"
#include "db_visitor.h"
#include "locate.h"
#include "directory.h"
@@ -119,6 +120,14 @@ static const struct db_visitor print_info_visitor = {
.playlist = print_visitor_playlist_info,
};
+bool
+db_selection_print(struct client *client, const struct db_selection *selection,
+ bool full, GError **error_r)
+{
+ return db_visit(selection, full ? &print_info_visitor : &print_visitor,
+ client, error_r);
+}
+
struct search_data {
struct client *client;
const struct locate_item_list *criteria;
@@ -233,14 +242,18 @@ searchStatsForSongsIn(struct client *client, const char *name,
bool
printAllIn(struct client *client, const char *uri_utf8, GError **error_r)
{
- return db_walk(uri_utf8, &print_visitor, client, error_r);
+ struct db_selection selection;
+ db_selection_init(&selection, uri_utf8, true);
+ return db_selection_print(client, &selection, false, error_r);
}
bool
printInfoForAllIn(struct client *client, const char *uri_utf8,
GError **error_r)
{
- return db_walk(uri_utf8, &print_info_visitor, client, error_r);
+ struct db_selection selection;
+ db_selection_init(&selection, uri_utf8, true);
+ return db_selection_print(client, &selection, true, error_r);
}
static ListCommandItem *