aboutsummaryrefslogtreecommitdiffstats
path: root/src/stats.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 14:02:57 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 14:02:57 +0200
commita6c5928c75a57a7f75279dfec39448899b22b046 (patch)
tree01ea130db2b9c270241e6f538037dca7d81acbb5 /src/stats.c
parent93e6d4c3adff4cfd06af77082793a0ba0fcf5fa5 (diff)
downloadmpd-a6c5928c75a57a7f75279dfec39448899b22b046.tar.gz
mpd-a6c5928c75a57a7f75279dfec39448899b22b046.tar.xz
mpd-a6c5928c75a57a7f75279dfec39448899b22b046.zip
stats: don't pass "fd" to printStats()
Pass the client struct instead of the raw file descriptor.
Diffstat (limited to 'src/stats.c')
-rw-r--r--src/stats.c27
1 files changed, 17 insertions, 10 deletions
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;
}