Stats: use struct DatabaseStats
Eliminate redundant declaration.
This commit is contained in:
parent
b9169a5670
commit
41a3fd0fd0
|
@ -31,7 +31,7 @@
|
|||
#include <glib.h>
|
||||
|
||||
static GTimer *uptime;
|
||||
static struct stats stats;
|
||||
static DatabaseStats stats;
|
||||
|
||||
void stats_global_init(void)
|
||||
{
|
||||
|
@ -51,17 +51,11 @@ void stats_update(void)
|
|||
|
||||
const DatabaseSelection selection("", true);
|
||||
if (GetDatabase()->GetStats(selection, stats2, error)) {
|
||||
stats.song_count = stats2.song_count;
|
||||
stats.song_duration = stats2.total_duration;
|
||||
stats.artist_count = stats2.artist_count;
|
||||
stats.album_count = stats2.album_count;
|
||||
stats = stats2;
|
||||
} else {
|
||||
LogError(error);
|
||||
|
||||
stats.song_count = 0;
|
||||
stats.song_duration = 0;
|
||||
stats.artist_count = 0;
|
||||
stats.album_count = 0;
|
||||
stats.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +74,7 @@ stats_print(Client &client)
|
|||
stats.song_count,
|
||||
(long)g_timer_elapsed(uptime, NULL),
|
||||
(long)(client.player_control.GetTotalPlayTime() + 0.5),
|
||||
stats.song_duration);
|
||||
stats.total_duration);
|
||||
|
||||
if (db_is_simple())
|
||||
client_printf(client,
|
||||
|
|
|
@ -22,21 +22,6 @@
|
|||
|
||||
class Client;
|
||||
|
||||
struct stats {
|
||||
/** number of song files in the music directory */
|
||||
unsigned song_count;
|
||||
|
||||
/** sum of all song durations in the music directory (in
|
||||
seconds) */
|
||||
unsigned long song_duration;
|
||||
|
||||
/** number of distinct artist names in the music directory */
|
||||
unsigned artist_count;
|
||||
|
||||
/** number of distinct album names in the music directory */
|
||||
unsigned album_count;
|
||||
};
|
||||
|
||||
void stats_global_init(void);
|
||||
|
||||
void stats_global_finish(void);
|
||||
|
|
Loading…
Reference in New Issue