aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/command.c2
-rw-r--r--src/stats.c27
-rw-r--r--src/stats.h4
3 files changed, 21 insertions, 12 deletions
diff --git a/src/command.c b/src/command.c
index 755d1a586..05c6ed22e 100644
--- a/src/command.c
+++ b/src/command.c
@@ -999,7 +999,7 @@ static int handleRandom(struct client *client, mpd_unused int *permission,
static int handleStats(struct client *client, mpd_unused int *permission,
mpd_unused int argc, mpd_unused char *argv[])
{
- return printStats(client_get_fd(client));
+ return printStats(client);
}
static int handleClearError(mpd_unused struct client *client, mpd_unused int *permission,
diff --git a/src/stats.c b/src/stats.c
index 7d5bf5d5c..280450f14 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -20,7 +20,7 @@
#include "directory.h"
#include "tag.h"
-#include "myfprintf.h"
+#include "client.h"
#include "player_control.h"
#include "tagTracker.h"
#include "os_compat.h"
@@ -33,15 +33,22 @@ void initStats(void)
stats.numberOfSongs = 0;
}
-int printStats(int fd)
+int printStats(struct client *client)
{
- fdprintf(fd, "artists: %i\n", getNumberOfTagItems(TAG_ITEM_ARTIST));
- fdprintf(fd, "albums: %i\n", getNumberOfTagItems(TAG_ITEM_ALBUM));
- fdprintf(fd, "songs: %i\n", stats.numberOfSongs);
- fdprintf(fd, "uptime: %li\n", time(NULL) - stats.daemonStart);
- fdprintf(fd, "playtime: %li\n",
- (long)(getPlayerTotalPlayTime() + 0.5));
- fdprintf(fd, "db_playtime: %li\n", stats.dbPlayTime);
- fdprintf(fd, "db_update: %li\n", getDbModTime());
+ client_printf(client,
+ "artists: %i\n"
+ "albums: %i\n"
+ "songs: %i\n"
+ "uptime: %li\n"
+ "playtime: %li\n"
+ "db_playtime: %li\n"
+ "db_update: %li\n",
+ getNumberOfTagItems(TAG_ITEM_ARTIST),
+ getNumberOfTagItems(TAG_ITEM_ALBUM),
+ stats.numberOfSongs,
+ time(NULL) - stats.daemonStart,
+ (long)(getPlayerTotalPlayTime() + 0.5),
+ stats.dbPlayTime,
+ getDbModTime());
return 0;
}
diff --git a/src/stats.h b/src/stats.h
index aca8c06ab..ac81f42f2 100644
--- a/src/stats.h
+++ b/src/stats.h
@@ -19,6 +19,8 @@
#ifndef STATS_H
#define STATS_H
+struct client;
+
typedef struct _Stats {
unsigned long daemonStart;
int numberOfSongs;
@@ -31,6 +33,6 @@ extern Stats stats;
void initStats(void);
-int printStats(int fd);
+int printStats(struct client *client);
#endif