song: use song_file_update() in song_file_load()
Eliminate duplicated code.
This commit is contained in:
parent
02e8c000d1
commit
4ab6b59aaf
13
src/song.c
13
src/song.c
@ -62,9 +62,7 @@ struct song *
|
|||||||
song_file_load(const char *path, struct directory *parent)
|
song_file_load(const char *path, struct directory *parent)
|
||||||
{
|
{
|
||||||
struct song *song;
|
struct song *song;
|
||||||
struct decoder_plugin *plugin;
|
bool ret;
|
||||||
unsigned int next = 0;
|
|
||||||
char path_max_tmp[MPD_PATH_MAX], *abs_path;
|
|
||||||
|
|
||||||
assert(parent != NULL);
|
assert(parent != NULL);
|
||||||
|
|
||||||
@ -75,13 +73,8 @@ song_file_load(const char *path, struct directory *parent)
|
|||||||
|
|
||||||
song = song_file_new(path, parent);
|
song = song_file_new(path, parent);
|
||||||
|
|
||||||
abs_path = rmp2amp_r(path_max_tmp, song_get_url(song, path_max_tmp));
|
ret = song_file_update(song);
|
||||||
while (song->tag == NULL &&
|
if (!ret) {
|
||||||
(plugin = isMusic(abs_path, &(song->mtime), next++))) {
|
|
||||||
song->tag = plugin->tag_dup(abs_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (song->tag == NULL || song->tag->time < 0) {
|
|
||||||
song_free(song);
|
song_free(song);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user