From 40978425da7321b2763381584543516ef5030cb1 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Wed, 10 Nov 2004 02:42:55 +0000 Subject: fix artist and album stats git-svn-id: https://svn.musicpd.org/mpd/branches/r2562-metadata-handling-rewrite@2569 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/stats.c | 6 ++++-- src/tagTracker.c | 6 ++++++ src/tagTracker.h | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/stats.c b/src/stats.c index 1daeb26e7..6efa8cb8f 100644 --- a/src/stats.c +++ b/src/stats.c @@ -21,6 +21,8 @@ #include "directory.h" #include "myfprintf.h" #include "player.h" +#include "tag.h" +#include "tagTracker.h" #include @@ -34,8 +36,8 @@ void initStats() { } int printStats(FILE * fp) { - /*myfprintf(fp,"artists: %li\n",numberOfArtists()); - myfprintf(fp,"albums: %li\n",numberOfAlbums());*/ + myfprintf(fp,"artists: %li\n", getNumberOfTagItems(TAG_ITEM_ARTIST)); + myfprintf(fp,"albums: %li\n", getNumberOfTagItems(TAG_ITEM_ALBUM)); myfprintf(fp,"songs: %i\n",stats.numberOfSongs); myfprintf(fp,"uptime: %li\n",time(NULL)-stats.daemonStart); myfprintf(fp,"playtime: %li\n",(long)(getPlayerTotalPlayTime()+0.5)); diff --git a/src/tagTracker.c b/src/tagTracker.c index fec96550a..ef95ea47a 100644 --- a/src/tagTracker.c +++ b/src/tagTracker.c @@ -48,3 +48,9 @@ void removeTagItemString(int type, char * string) { tagLists[type] = NULL; } } + +int getNumberOfTagItems(int type) { + if(tagLists[type] == NULL) return 0; + + return tagLists[type]->numberOfNodes; +} diff --git a/src/tagTracker.h b/src/tagTracker.h index c30185e2b..6b3049a0f 100644 --- a/src/tagTracker.h +++ b/src/tagTracker.h @@ -7,4 +7,6 @@ char * getTagItemString(int type, char * string); void removeTagItemString(int type, char * string); +int getNumberOfTagItems(int type); + #endif -- cgit v1.2.3