diff options
author | Max Kellermann <max@duempel.org> | 2009-01-24 14:55:28 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-24 14:55:28 +0100 |
commit | cf9595df187d005489f8b94ed27dba2a6c94fd78 (patch) | |
tree | 8ac4d3bb1216b3be378d7e50b8cdda0a16f23dbd /src/queue_print.c | |
parent | 53e712aca40d631bd26a2af4c0731aa8924cde5b (diff) | |
download | mpd-cf9595df187d005489f8b94ed27dba2a6c94fd78.tar.gz mpd-cf9595df187d005489f8b94ed27dba2a6c94fd78.tar.xz mpd-cf9595df187d005489f8b94ed27dba2a6c94fd78.zip |
playlist: removed locate functions to queue_print.c
Now playlist.c does not contain any protocol specific code anymore.
Diffstat (limited to 'src/queue_print.c')
-rw-r--r-- | src/queue_print.c | 34 |
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); + } +} |