aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-18 15:22:26 +0100
committerMax Kellermann <max@duempel.org>2009-01-18 15:22:26 +0100
commit0d449d8df745c5c527f637f42e33156b92ac174d (patch)
tree9babb10fb34383f225acdf882898ac7d76b1a51a /src
parente8c148ab02f4dc9c0531ec97acdc3bda804313cc (diff)
stats: no CamelCase
Renamed functions and types.
Diffstat (limited to 'src')
-rw-r--r--src/command.c2
-rw-r--r--src/main.c2
-rw-r--r--src/stats.c22
-rw-r--r--src/stats.h23
4 files changed, 26 insertions, 23 deletions
diff --git a/src/command.c b/src/command.c
index 1fac4fd0..9eac2438 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1061,7 +1061,7 @@ static enum command_return
handle_stats(struct client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{
- return printStats(client);
+ return stats_print(client);
}
static enum command_return
diff --git a/src/main.c b/src/main.c
index 314478d8..d5bb98dc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -243,7 +243,7 @@ int main(int argc, char *argv[])
if (options.kill)
killFromPidFile();
- initStats();
+ stats_global_init();
tag_lib_init();
log_init(options.verbose, options.stdOutput);
diff --git a/src/stats.c b/src/stats.c
index dd56f754..ce7ecb2d 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -26,18 +26,17 @@
#include "strset.h"
#include "dbUtils.h"
-Stats stats;
+struct stats stats;
-void initStats(void)
+void stats_global_init(void)
{
- stats.daemonStart = time(NULL);
- stats.numberOfSongs = 0;
+ stats.start_time = time(NULL);
}
void stats_update(void)
{
- stats.numberOfSongs = countSongsIn(NULL);
- stats.dbPlayTime = sumSongTimesIn(NULL);
+ stats.song_count = countSongsIn(NULL);
+ stats.song_duration = sumSongTimesIn(NULL);
}
struct visit_data {
@@ -63,7 +62,8 @@ visit_tag_items(struct song *song, void *_data)
return 0;
}
-static unsigned int getNumberOfTagItems(int type)
+static unsigned int
+getNumberOfTagItems(enum tag_type type)
{
struct visit_data data = {
.type = type,
@@ -78,7 +78,7 @@ static unsigned int getNumberOfTagItems(int type)
return ret;
}
-int printStats(struct client *client)
+int stats_print(struct client *client)
{
client_printf(client,
"artists: %u\n"
@@ -90,10 +90,10 @@ int printStats(struct client *client)
"db_update: %li\n",
getNumberOfTagItems(TAG_ITEM_ARTIST),
getNumberOfTagItems(TAG_ITEM_ALBUM),
- stats.numberOfSongs,
- time(NULL) - stats.daemonStart,
+ stats.song_count,
+ time(NULL) - stats.start_time,
(long)(getPlayerTotalPlayTime() + 0.5),
- stats.dbPlayTime,
+ stats.song_duration,
db_get_mtime());
return 0;
}
diff --git a/src/stats.h b/src/stats.h
index 399d6c68..143ee004 100644
--- a/src/stats.h
+++ b/src/stats.h
@@ -21,20 +21,23 @@
struct client;
-typedef struct _Stats {
- unsigned long daemonStart;
- int numberOfSongs;
- unsigned long dbPlayTime;
- /*unsigned long playTime;
- unsigned long songsPlayed; */
-} Stats;
+struct stats {
+ unsigned long start_time;
-extern Stats stats;
+ /** number of song files in the music directory */
+ unsigned song_count;
-void initStats(void);
+ /** sum of all song durations in the music directory (in
+ seconds) */
+ unsigned long song_duration;
+};
+
+extern struct stats stats;
+
+void stats_global_init(void);
void stats_update(void);
-int printStats(struct client *client);
+int stats_print(struct client *client);
#endif