aboutsummaryrefslogtreecommitdiffstats
path: root/src/queue_print.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/queue_print.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/queue_print.c b/src/queue_print.c
index 4ff43b181..fb56d4ad6 100644
--- a/src/queue_print.c
+++ b/src/queue_print.c
@@ -20,6 +20,7 @@
#include "queue.h"
#include "song.h"
#include "song_print.h"
+#include "locate.h"
#include "client.h"
void
@@ -77,3 +78,36 @@ queue_print_changes_position(struct client *client, const struct queue *queue,
client_printf(client, "cpos: %i\nId: %i\n",
i, queue_position_to_id(queue, i));
}
+
+void
+queue_search(struct client *client, const struct queue *queue,
+ unsigned num_items, const struct locate_item *items)
+{
+ unsigned i;
+ struct locate_item *new_items =
+ g_memdup(items, sizeof(items[0]) * num_items);
+
+ for (i = 0; i < num_items; i++)
+ new_items[i].needle = g_utf8_casefold(new_items[i].needle, -1);
+
+ for (i = 0; i < queue_length(queue); i++) {
+ const struct song *song = queue_get(queue, i);
+
+ if (strstrSearchTags(song, num_items, items))
+ queue_print_song_info(client, queue, i);
+ }
+
+ freeLocateTagItemArray(num_items, new_items);
+}
+
+void
+queue_find(struct client *client, const struct queue *queue,
+ unsigned num_items, const struct locate_item *items)
+{
+ for (unsigned i = 0; i < queue_length(queue); i++) {
+ const struct song *song = queue_get(queue, i);
+
+ if (tagItemsFoundAndMatches(song, num_items, items))
+ queue_print_song_info(client, queue, i);
+ }
+}