MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / GetStats

Method GetStats

src/db/plugins/ProxyDatabasePlugin.cxx:945–968  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

943}
944
945DatabaseStats
946ProxyDatabase::GetStats(const DatabaseSelection &selection) const
947{
948 // TODO: match
949 (void)selection;
950
951 // TODO: eliminate the const_cast
952 const_cast<ProxyDatabase *>(this)->EnsureConnected();
953
954 struct mpd_stats *stats2 =
955 mpd_run_stats(connection);
956 if (stats2 == nullptr)
957 ThrowError(connection);
958
959 update_stamp = std::chrono::system_clock::from_time_t(mpd_stats_get_db_update_time(stats2));
960
961 DatabaseStats stats;
962 stats.song_count = mpd_stats_get_number_of_songs(stats2);
963 stats.total_duration = std::chrono::seconds(mpd_stats_get_db_play_time(stats2));
964 stats.artist_count = mpd_stats_get_number_of_artists(stats2);
965 stats.album_count = mpd_stats_get_number_of_albums(stats2);
966 mpd_stats_free(stats2);
967 return stats;
968}
969
970unsigned
971ProxyDatabase::Update(const char *uri_utf8, bool discard)

Callers 1

stats_updateFunction · 0.45

Calls 2

ThrowErrorFunction · 0.85
EnsureConnectedMethod · 0.80

Tested by

no test coverage detected