mpd: separate statistics

This commit is contained in:
Andrzej Rybczak
2012-09-06 14:26:02 +02:00
parent 0147a24add
commit fcf9ffe668
3 changed files with 93 additions and 36 deletions

View File

@@ -97,23 +97,26 @@ void ServerInfo::Update()
return;
gettimeofday(&past, 0);
Mpd.UpdateStats();
MPD::Statistics stats = Mpd.getStatistics();
if (stats.empty())
return;
w->clear();
*w << NC::fmtBold << U("Version: ") << NC::fmtBoldEnd << U("0.") << Mpd.Version() << U(".*\n");
*w << NC::fmtBold << U("Uptime: ") << NC::fmtBoldEnd;
ShowTime(*w, Mpd.Uptime(), 1);
ShowTime(*w, stats.uptime(), 1);
*w << '\n';
*w << NC::fmtBold << U("Time playing: ") << NC::fmtBoldEnd << MPD::Song::ShowTime(Mpd.PlayTime()) << '\n';
*w << NC::fmtBold << U("Time playing: ") << NC::fmtBoldEnd << MPD::Song::ShowTime(stats.playTime()) << '\n';
*w << '\n';
*w << NC::fmtBold << U("Total playtime: ") << NC::fmtBoldEnd;
ShowTime(*w, Mpd.DBPlayTime(), 1);
ShowTime(*w, stats.dbPlayTime(), 1);
*w << '\n';
*w << NC::fmtBold << U("Artist names: ") << NC::fmtBoldEnd << Mpd.NumberOfArtists() << '\n';
*w << NC::fmtBold << U("Album names: ") << NC::fmtBoldEnd << Mpd.NumberOfAlbums() << '\n';
*w << NC::fmtBold << U("Songs in database: ") << NC::fmtBoldEnd << Mpd.NumberOfSongs() << '\n';
*w << NC::fmtBold << U("Artist names: ") << NC::fmtBoldEnd << stats.artists() << '\n';
*w << NC::fmtBold << U("Album names: ") << NC::fmtBoldEnd << stats.albums() << '\n';
*w << NC::fmtBold << U("Songs in database: ") << NC::fmtBoldEnd << stats.songs() << '\n';
*w << '\n';
*w << NC::fmtBold << U("Last DB update: ") << NC::fmtBoldEnd << Timestamp(Mpd.DBUpdateTime()) << '\n';
*w << NC::fmtBold << U("Last DB update: ") << NC::fmtBoldEnd << Timestamp(stats.dbUpdateTime()) << '\n';
*w << '\n';
*w << NC::fmtBold << U("URL Handlers:") << NC::fmtBoldEnd;
for (auto it = itsURLHandlers.begin(); it != itsURLHandlers.end(); ++it)