aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-04-01 18:41:37 +0200
committerMax Kellermann <max@duempel.org>2009-04-01 18:41:37 +0200
commit7f38c3fc78f7dd3c542cdb73bcd45bfe2208a5a8 (patch)
tree9f3c8de9b5f3ef58960268aab0c2cf8d9e6e0591 /src/database.c
parent36ec2edacfbf17b5308312ad5617117685004174 (diff)
downloadmpd-7f38c3fc78f7dd3c542cdb73bcd45bfe2208a5a8.tar.gz
mpd-7f38c3fc78f7dd3c542cdb73bcd45bfe2208a5a8.tar.xz
mpd-7f38c3fc78f7dd3c542cdb73bcd45bfe2208a5a8.zip
directory: added directory_lookup_song()
Moved code from db_get_song().
Diffstat (limited to '')
-rw-r--r--src/database.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/src/database.c b/src/database.c
index 94527e72d..7257930bc 100644
--- a/src/database.c
+++ b/src/database.c
@@ -110,10 +110,6 @@ db_get_directory(const char *name)
struct song *
db_get_song(const char *file)
{
- struct song *song;
- struct directory *directory;
- char *duplicated, *shortname, *dir;
-
assert(file != NULL);
g_debug("get song: %s", file);
@@ -121,27 +117,7 @@ db_get_song(const char *file)
if (music_root == NULL)
return NULL;
- duplicated = g_strdup(file);
- shortname = strrchr(duplicated, '/');
- if (!shortname) {
- shortname = duplicated;
- dir = NULL;
- } else {
- *shortname = '\0';
- ++shortname;
- dir = duplicated;
- }
-
- directory = db_get_directory(dir);
- if (directory != NULL)
- song = songvec_find(&directory->songs, shortname);
- else
- song = NULL;
-
- assert(song == NULL || song->parent == directory);
-
- g_free(duplicated);
- return song;
+ return directory_lookup_song(music_root, file);
}
int