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().
This commit is contained in:
Max Kellermann
2008-10-09 19:11:54 +02:00
parent 0677116da0
commit 7dd099a60f
4 changed files with 25 additions and 14 deletions

View File

@@ -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);
}