int cmd_stats(mpd_unused int argc, mpd_unused char **argv, mpd_Connection *conn) { mpd_Stats *stats; time_t t; mpd_sendStatsCommand(conn); stats = mpd_getStats(conn); printErrorAndExit(conn); if (stats != NULL) { t = stats->dbUpdateTime; printf("Artists: %6d\n", stats->numberOfArtists); printf("Albums: %6d\n", stats->numberOfAlbums); printf("Songs: %6d\n", stats->numberOfSongs); printf("\n"); printf("Play Time: %s\n", DHMS(stats->playTime)); printf("Uptime: %s\n", DHMS(stats->uptime)); printf("DB Updated: %s", ctime(&t)); /* no \n needed */ printf("DB Play Time: %s\n", DHMS(stats->dbPlayTime)); mpd_freeStats(stats); } else { printf("Error getting mpd stats\n"); } return 0; }
int cmd_stats(gcc_unused int argc, gcc_unused char **argv, struct mpd_connection *conn) { struct mpd_stats *stats = mpd_run_stats(conn); if (stats == NULL) printErrorAndExit(conn); printf("Artists: %6d\n", mpd_stats_get_number_of_artists(stats)); printf("Albums: %6d\n", mpd_stats_get_number_of_albums(stats)); printf("Songs: %6d\n", mpd_stats_get_number_of_songs(stats)); printf("\n"); printf("Play Time: %s\n", DHMS(mpd_stats_get_play_time(stats))); printf("Uptime: %s\n", DHMS(mpd_stats_get_uptime(stats))); time_t t = mpd_stats_get_db_update_time(stats); printf("DB Updated: %s", ctime(&t)); /* no \n needed */ printf("DB Play Time: %s\n", DHMS(mpd_stats_get_db_play_time(stats))); mpd_stats_free(stats); return 0; }