Commit 6acba735 authored by Max Kellermann's avatar Max Kellermann

stats: added stats_update()

parent 5c477f60
......@@ -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;
......
......@@ -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;
......
......@@ -33,6 +33,8 @@ extern Stats stats;
void initStats(void);
void stats_update(void);
int printStats(struct client *client);
#endif
......@@ -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();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment