aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/database.c5
-rw-r--r--src/stats.c7
-rw-r--r--src/stats.h2
-rw-r--r--src/update.c4
4 files changed, 11 insertions, 7 deletions
diff --git a/src/database.c b/src/database.c
index 42dd0221..b465a347 100644
--- a/src/database.c
+++ b/src/database.c
@@ -25,9 +25,7 @@
#include "ls.h"
#include "path.h"
#include "stats.h"
-#include "dbUtils.h"
#include "update.h"
-#include "event_pipe.h"
#include "config.h"
#include <glib.h>
@@ -318,8 +316,7 @@ db_load(void)
directory_load(fp, music_root);
while (fclose(fp) && errno == EINTR) ;
- stats.numberOfSongs = countSongsIn(NULL);
- stats.dbPlayTime = sumSongTimesIn(NULL);
+ stats_update();
if (stat(dbFile, &st) == 0)
directory_dbModTime = st.st_mtime;
diff --git a/src/stats.c b/src/stats.c
index 53c78561..dd56f754 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -24,6 +24,7 @@
#include "client.h"
#include "player_control.h"
#include "strset.h"
+#include "dbUtils.h"
Stats stats;
@@ -33,6 +34,12 @@ void initStats(void)
stats.numberOfSongs = 0;
}
+void stats_update(void)
+{
+ stats.numberOfSongs = countSongsIn(NULL);
+ stats.dbPlayTime = sumSongTimesIn(NULL);
+}
+
struct visit_data {
enum tag_type type;
struct strset *set;
diff --git a/src/stats.h b/src/stats.h
index 81724c71..399d6c68 100644
--- a/src/stats.h
+++ b/src/stats.h
@@ -33,6 +33,8 @@ extern Stats stats;
void initStats(void);
+void stats_update(void);
+
int printStats(struct client *client);
#endif
diff --git a/src/update.c b/src/update.c
index 8061acaf..6aecd326 100644
--- a/src/update.c
+++ b/src/update.c
@@ -32,7 +32,6 @@
#include "idle.h"
#include "conf.h"
#include "stats.h"
-#include "dbUtils.h"
#include "main.h"
#include <glib.h>
@@ -739,8 +738,7 @@ static void update_finished_event(void)
} else {
progress = UPDATE_PROGRESS_IDLE;
- stats.numberOfSongs = countSongsIn(NULL);
- stats.dbPlayTime = sumSongTimesIn(NULL);
+ stats_update();
}
}