diff options
author | Max Kellermann <max@duempel.org> | 2008-10-09 19:11:54 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-09 19:11:54 +0200 |
commit | 7dd099a60f0a966382e5369ac064f9089ce0c8c9 (patch) | |
tree | 9758b6b6f278be7374aefb0487e4aafb4340e46b /src/database.c | |
parent | 0677116da0d61097af44e5d84d763ccae450c077 (diff) | |
download | mpd-7dd099a60f0a966382e5369ac064f9089ce0c8c9.tar.gz mpd-7dd099a60f0a966382e5369ac064f9089ce0c8c9.tar.xz mpd-7dd099a60f0a966382e5369ac064f9089ce0c8c9.zip |
update: don't export updateDirectory()
If the user requests database update during startup, call
directory_update_init(). This should be changed to fully asynchronous
update later.
For this to work, main_notify has to be initialized before db_init().
Diffstat (limited to '')
-rw-r--r-- | src/database.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c index 93d0d7ef8..bd069f8b4 100644 --- a/src/database.c +++ b/src/database.c @@ -29,6 +29,7 @@ #include "utils.h" #include "dbUtils.h" #include "update.h" +#include "main_notify.h" #include <assert.h> #include <string.h> @@ -40,8 +41,19 @@ static time_t directory_dbModTime; void db_init(void) { + int ret; + music_root = directory_new("", NULL); - updateDirectory(music_root); + + ret = directory_update_init(NULL); + if (ret < 0) + FATAL("directory update failed\n"); + + do { + wait_main_task(); + reap_update_task(); + } while (isUpdatingDB()); + stats.numberOfSongs = countSongsIn(NULL); stats.dbPlayTime = sumSongTimesIn(NULL); } |