| 943 | } |
| 944 | |
| 945 | DatabaseStats |
| 946 | ProxyDatabase::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 | |
| 970 | unsigned |
| 971 | ProxyDatabase::Update(const char *uri_utf8, bool discard) |
no test coverage detected