From 44ce52f45732fa0c293da88afb384c6cbc9c8b9f Mon Sep 17 00:00:00 2001 From: waker Date: Wed, 16 May 2012 19:46:20 +0200 Subject: added filename handling to search_process --- playlist.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'playlist.c') diff --git a/playlist.c b/playlist.c index cc8eca64..11a280c1 100644 --- a/playlist.c +++ b/playlist.c @@ -3543,9 +3543,20 @@ plt_search_process (playlist_t *playlist, const char *text) { if (*text) { DB_metaInfo_t *m = NULL; for (m = it->meta; m; m = m->next) { - if (m->key[0] == ':' || m->key[0] == '_' || m->key[0] == '!') { + int is_uri = !strcmp (m->key, ":URI"); + if ((m->key[0] == ':' && !is_uri) || m->key[0] == '_' || m->key[0] == '!') { break; } + const char *value = m->value; + if (is_uri) { + value = strrchr (value, '/'); + if (value) { + value++; + } + else { + value = m->value; + } + } if (strcasecmp(m->key, "cuesheet") && strcasecmp (m->key, "log")) { char cmp = *(m->value-1); @@ -3565,8 +3576,8 @@ plt_search_process (playlist_t *playlist, const char *text) { break; } } - else if (utfcasestr_fast (m->value, lc)) { - //fprintf (stderr, "%s -> %s match (%s.%s)\n", text, m->value, pl_find_meta_raw (it, ":URI"), m->key); + else if (utfcasestr_fast (value, lc)) { + //fprintf (stderr, "%s -> %s match (%s.%s)\n", text, value, pl_find_meta_raw (it, ":URI"), m->key); // add to list it->next[PL_SEARCH] = NULL; it->prev[PL_SEARCH] = playlist->tail[PL_SEARCH]; -- cgit v1.2.3