From 1a79de743029449f0728021157b324d8a14bef64 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Mon, 16 Aug 2010 01:48:51 +0200 Subject: Implemented the get_raw command. --- music.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'music.c') diff --git a/music.c b/music.c index 8852835..c64a2ba 100644 --- a/music.c +++ b/music.c @@ -100,6 +100,25 @@ struct directory *music_find_dir(const gchar *path) { return music_find_dir_rec(music_root, path); } +struct file *music_find_file(const gchar *path) { + gchar *dirname = g_path_get_dirname(path); + gchar *filename = g_path_get_basename(path); + + struct directory *directory = music_find_dir(dirname); + + if(directory == NULL) { + return NULL; + } + + for(struct file *f = directory->files; f; f = f->next) { + if(g_strcmp0(filename, f->name) == 0) { + return f; + } + } + + return NULL; +} + static void music_do_free(struct directory *root) { struct directory *node; -- cgit v1.2.3