aboutsummaryrefslogtreecommitdiffstats
path: root/src/filelist.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-03 11:53:55 +0200
committerMax Kellermann <max@duempel.org>2008-10-03 11:53:55 +0200
commite2c8e28ef7ccda32fb32792b086c40144df2a916 (patch)
tree711b920ed4c51271b71bf9d83dc20369234f86b1 /src/filelist.c
parent40875b7a771ba26c528877eb13f80e476c86cc3a (diff)
downloadmpd-e2c8e28ef7ccda32fb32792b086c40144df2a916.tar.gz
mpd-e2c8e28ef7ccda32fb32792b086c40144df2a916.tar.xz
mpd-e2c8e28ef7ccda32fb32792b086c40144df2a916.zip
filelist: added filelist_find_directory()
The function filelist_find_directory() will be useful for the following patch.
Diffstat (limited to 'src/filelist.c')
-rw-r--r--src/filelist.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/filelist.c b/src/filelist.c
index 46137cd3b..415eec402 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -139,3 +139,22 @@ filelist_find_song(struct filelist *fl, const struct mpd_song *song)
return NULL;
}
+
+int
+filelist_find_directory(struct filelist *filelist, const char *name)
+{
+ guint i;
+
+ assert(name != NULL);
+
+ for (i = 0; i < filelist_length(filelist); ++i) {
+ struct filelist_entry *entry = filelist_get(filelist, i);
+ mpd_InfoEntity *entity = entry->entity;
+
+ if (entity && entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY &&
+ strcmp(entity->info.directory->path, name) == 0)
+ return i;
+ }
+
+ return -1;
+}