aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-08 11:06:27 +0200
committerMax Kellermann <max@duempel.org>2008-10-08 11:06:27 +0200
commit4ab6b59aaf9db6d6108b0734da2307f7fac7fb4b (patch)
tree6372c7edd89a1aeb3b6ee93e3e7e3b5c77bcb576
parent02e8c000d1eaa2ff3c81bf59b8293b8912d5be3c (diff)
downloadmpd-4ab6b59aaf9db6d6108b0734da2307f7fac7fb4b.tar.gz
mpd-4ab6b59aaf9db6d6108b0734da2307f7fac7fb4b.tar.xz
mpd-4ab6b59aaf9db6d6108b0734da2307f7fac7fb4b.zip
song: use song_file_update() in song_file_load()
Eliminate duplicated code.
-rw-r--r--src/song.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/song.c b/src/song.c
index 24fd2d733..bf4be4901 100644
--- a/src/song.c
+++ b/src/song.c
@@ -62,9 +62,7 @@ struct song *
song_file_load(const char *path, struct directory *parent)
{
struct song *song;
- struct decoder_plugin *plugin;
- unsigned int next = 0;
- char path_max_tmp[MPD_PATH_MAX], *abs_path;
+ bool ret;
assert(parent != NULL);
@@ -75,13 +73,8 @@ song_file_load(const char *path, struct directory *parent)
song = song_file_new(path, parent);
- abs_path = rmp2amp_r(path_max_tmp, song_get_url(song, path_max_tmp));
- while (song->tag == NULL &&
- (plugin = isMusic(abs_path, &(song->mtime), next++))) {
- song->tag = plugin->tag_dup(abs_path);
- }
-
- if (song->tag == NULL || song->tag->time < 0) {
+ ret = song_file_update(song);
+ if (!ret) {
song_free(song);
return NULL;
}