summaryrefslogtreecommitdiff
path: root/music.c
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-08-16 01:48:51 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2010-08-16 01:48:51 +0200
commit1a79de743029449f0728021157b324d8a14bef64 (patch)
tree5952cb4871b3a1a88e280e80ff103372f3cba76c /music.c
parent4fcb7baeec6d7c2f9fb9c976a66b78e80fd8622e (diff)
Implemented the get_raw command.
Diffstat (limited to 'music.c')
-rw-r--r--music.c19
1 files changed, 19 insertions, 0 deletions
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;